Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

how to search for record in database

$
0
0
I want to search my database table for a certain record but the search is only when it is not the first record. If it is the first record the search code will not return true. Is there any adjustments I need to make to my Code so that even if the record is the first one it will return true

Code:


Private Function CheckIfVehicleTypeIsValid() As Boolean
    Dim strCriteria As String
    strCriteria = "TruckType=" & " '" & Trim(DataComboVehicleType.Text) & "' "
    Set rstTrucks = New ADODB.Recordset
    rstTrucks.Open "TruckTypes", Cnn, adOpenForwardOnly, , adCmdTable
    rstTrucks.Find strCriteria, 1, adSearchForward
    If rstTrucks.EOF Then
    CheckIfVehicleTypeIsValid = False
    Else
    CheckIfVehicleTypeIsValid = True
    End If
  End Function


Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>