|
-
Apr 5th, 2001, 07:39 AM
#1
Thread Starter
New Member
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
-
Apr 5th, 2001, 07:52 AM
#2
Addicted Member
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
-
Apr 5th, 2001, 08:03 AM
#3
Fanatic Member
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.
Not nearly so tired now...
Haven't been around much so be gentle...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|