Recordset

marrett

Registered User.
Local time
Today, 22:15
Joined
Sep 8, 2000
Messages
43
Hi
I Need to get the following statement to work.


Set RST = db.OpenRecordset("Select * From [users]where [user]=" & Forms!usersignin!User)

User in users is text. Please help.
 
For string criteria you need to put the data in single quotes. Try:

Set RST = db.OpenRecordset("Select * From [users]where [user]= '" & Forms!usersignin!User & "'")

Hope this works,
Paul
 
Thanks Paul,

I Still cannot get it to work.

I used your s and I get the error> Method 'Item' of Object 'Forms' Failed

Set RST = db.OpenRecordset("Select * From [users]where [user]= '" & Forms!usersignin!User & "'")

Please help.

Thnaks,

Maria
 
Is this as simple as

Set RST = db.OpenRecordset("Select * From [users]where [user]= '" & Forms!usersignin!User.Value & "'")

??? or caption ???

Art
 
Sometimes it is hard to spot syntax errors in strings built this way. Try storing the SQL string in a variable and then looking at what got stored.

dim strSQL as String
strSQL = Select * From [users]where [user]= '" & Forms!usersignin!User & "'"

Set RST = db.OpenRecordset(strSQL)

Put a stop on the set statement and look at the value in strSQL and see if you can see the syntax error. Open the debug window and print it if you can't see the whole thing when you put your mouse pointer over the variable. There is no space between [users] and where. That could be the problem.
 
In all the examples no-one has placed a space before "WHERE" to separate it from the recordsource [users].
 

Users who are viewing this thread

Back
Top Bottom