humpydumpy2000
IS-IT--Management
hi, i am using ADODB to find records in a table that matches criteria in a textbox. It works fine except when I try to use it to find an ID field (primary key)
Dim rsFname As New ADODB.Recordset
rsFname.Open "SELECT * FROM tblCustomers " & _
"WHERE CustomerID = '" & CustID & "';", _
CodeProject.Connection, _
adOpenStatic, _
adLockOptimistic, _
adCmdText
With rsFname
Do While Not .EOF
If rsFname("CustID").Value = CustomerID Then
CustomerName = .Fields("Custname").Value
Exit Do
End If
.MoveNext
Loop
End With
Any help is greatly appreciated. Thanks in advance
Dim rsFname As New ADODB.Recordset
rsFname.Open "SELECT * FROM tblCustomers " & _
"WHERE CustomerID = '" & CustID & "';", _
CodeProject.Connection, _
adOpenStatic, _
adLockOptimistic, _
adCmdText
With rsFname
Do While Not .EOF
If rsFname("CustID").Value = CustomerID Then
CustomerName = .Fields("Custname").Value
Exit Do
End If
.MoveNext
Loop
End With
Any help is greatly appreciated. Thanks in advance