-
I am trying to get back a recordset which contains a number
My database looks roughly like this
IdNum Name
8 Sam
9 John
10 Sara
I am getting back sam and john when they are selected but when
it comes to sara, i am getting back a 0
The same thing is happening for record no 20, 30 etc., infact anything
with a trailing 0, I get back a 0
The idnum field in the database is a long integer.
I have tried defining my variable in vb as a long and it still does not work
Public Sub Getidnumber(intidnum As Integer)
Dim rsrecord As ADODB.Recordset
Set rsrecord = New ADODB.Recordset
rsrecord.Open "Select idnum, name from Table1", gCnn, adOpenDynamic, adLockOptimistic
rsrecord.MoveFirst
Do Until rsrecord.EOF
'check for the exact match
If rsrecord("name") = frmFirst.txtName.text Then
intidnum = rsrecord("idnum")
End If
rsrecord.MoveNext
Loop
End If
Please help. Thankssss
-
Try this:
Code:
Set rsrecord = New ADODB.Recordset
rsrecord.Open "Select idnum, name from Table1", gCnn, adOpenDynamic, adLockOptimistic
With rsrecord
.MoveFirst
.Find "[name]='" & val(frmFirst.txtName.text ) & "'"
End With
-
Have you tried binding a control to the idnum and checking them that way?
What do you get back for idnum 11?
Very odd. More info please.
Cheers,
P.