Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

db.OpenRecordset

Status
Not open for further replies.

pcdaveh

Technical User
Joined
Sep 26, 2000
Messages
213
Location
US
I have a record set object that points to a query. I'm tring to get vba to recognize it and it won't. Please tell me what is wrong with this code. The error I get is invalid argument

Thanks!

Dim db As Database
Dim rst As Recordset
Dim x As Integer
Dim li_OnOff As Integer
Set db = CurrentDb()
Set rst = db.OpenRecordset("q_TransactionSummaryForm", dbOpenDynamic)

 
Have you referenced your project to?

Project
References
Select Microsoft DAO 3.51 Object Library

Hope it helps,

AmaHerrn
 
By the way, why not doing directly

Set rst = Currentdb.openrecordset("your Query or table", dbopendynaset)

I notice now that dbopendynamic,.. is that valid? try with dynaset instead of dynamic.
 
Amaherrn is correct isn't he. The invalid arguement is the dbOpenDynamic. Like he/she said, it should be dbOpenDyanset.

Nick
 
Hi!

I think dbOpenDynamic will only be a problem if the query references linked tables. I believe you can only use Dynamic with objects in the direct workspace?

hth
Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top