Rst Query -doing it wrong?

kit_sune

Registered User.
Local time
Yesterday, 21:38
Joined
Aug 19, 2013
Messages
88
Help!

I need to refer to a query called "UserID Query" to create a record set!!!

I thought this would work but it seems to be locking out my database...
Code:
SQL = "[UserID Query]"
Set rst = DBEngine(0)(0).OpenRecordset(SQL)

It's possible that this is good and the error is elsewhere but at this time this is where I'm looking.

Thanks for all your help!!!

~Kit
 
Perhaps something like:
Code:
Set rst = Currentdb.OpenRecordset(SQL)
 
Even if there is a space, don't use square brackets in the query name.
Code:
SQL = "UserID Query"
Set rst = CurrentDb.OpenRecordset(SQL)
 
There's nothing wrong with
Set rst = DBEngine(0)(0).OpenRecordset(SQL)

except I think you might find SQL is a reserved word in Access.

Try using strSQL as your variable.
 

Users who are viewing this thread

Back
Top Bottom