samantha72
April 5th, 2001, 08:08 AM
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 in my recordset. If it is 21 then I get back 21
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
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 in my recordset. If it is 21 then I get back 21
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