Can anyone tell me why my code doesn't work...
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID=userName", dbOpenDynaset)
username is a string defined previously ("Brian").
thanks
Printable View
Can anyone tell me why my code doesn't work...
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID=userName", dbOpenDynaset)
username is a string defined previously ("Brian").
thanks
try Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID='" & userName & ''", dbOpenDynaset)Quote:
Originally posted by 2000a
Can anyone tell me why my code doesn't work...
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID=userName", dbOpenDynaset)
username is a string defined previously ("Brian").
thanks
it returns 1... I have 6 records with that username...
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID='" & userName & "'", dbOpenDynaset)
What's userid in your database? an autonumber?
did you forget to loop through the record?Quote:
Originally posted by 2000a
it returns 1... I have 6 records with that username...
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID='" & userName & "'", dbOpenDynaset)
[Highlight=VB]
do until rs2.eof
msgbox rs2("Username")
loop
[/vbvode]
did you forget to loop through the record?Quote:
Originally posted by 2000a
it returns 1... I have 6 records with that username...
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID='" & userName & "'", dbOpenDynaset)
VB Code:
do until rs2.eof msgbox rs2("userID") loop
sorry,
the rs2 is working, but: rs2.RecordCount is only returning one record...
I printed the userNames with a do while and they all show...
How can I count without a loop?
thanks
.recordcount is not accurate if your usingQuote:
Originally posted by 2000a
sorry,
the rs2 is working, but: rs2.RecordCount is only returning one record...
I printed the userNames with a do while and they all show...
How can I count without a loop?
thanks
dbOpenDynaset
you have to use OpenStatic or the other ones ( i forgot which one)
but i wouldnt recommend using .recordcount cus it still loops through the records..
Now i'm having trouble with:
Set rs2 = db.OpenRecordset("SELECT * FROM tblLicenses WHERE tblLicenses.userID='" & userName & "' AND tblLicenses.appName='" & appName & "'", dbOpenDynaset)
What's wrong with the AND?
thanks
whats the error yoru getting?
too few parameters. expected 1
VB Code:
Dim SQL as string SQL = "SELECT * FROM tblLicenses WHERE tblLicenses.userID='" & userName & "' AND tblLicenses.appName='" & appName & "'" msgbox SQL Set rs2 = db.OpenRecordsetdb(SQL, OpenDynaset)
see what that prints out first