OpenRecordset - sometimes it works, sometimes it doesn't


J

John B. Smotherman

I'm using the database.openrecordset method, passing either a query name or
SQL code as the Name parameter and not specifying a parameter for Type,
Options or LockEdit, which are all optional. Here's a short example that
works:

dim db as DAO.Database
dim rst as DAO.RecordSet

set db = Currentdb()
set rst = db.OpenRecordset ( "qryTaskTimeline" )
'processing results here
'blah blah blah
rst.close
db.close

I use similar code in several subs or functions and it all works just fine,
but in the latest function I get an error 3061 "Too few parameters. Expected
3."

I tried putting a breakpoint immediately before the db.OpenRecordset and
manually executing the query, just to check. No problem there, so I close the
query, switch back to the VBA window and step over the db.openrecordset and
still get the error... Anyone have an idea?

Thanks!
 
Ad

Advertisements

Í

íÅÈÒÉÄÖÅÍÁÌ áÔÁÂÁÅ×Á

"John B. Smotherman" <[email protected]>
ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
I'm using the database.openrecordset method, passing either a query name
or
SQL code as the Name parameter and not specifying a parameter for Type,
Options or LockEdit, which are all optional. Here's a short example that
works:

dim db as DAO.Database
dim rst as DAO.RecordSet

set db = Currentdb()
set rst = db.OpenRecordset ( "qryTaskTimeline" )
'processing results here
'blah blah blah
rst.close
db.close

I use similar code in several subs or functions and it all works just
fine,
but in the latest function I get an error 3061 "Too few parameters.
Expected
3."

I tried putting a breakpoint immediately before the db.OpenRecordset and
manually executing the query, just to check. No problem there, so I close
the
query, switch back to the VBA window and step over the db.openrecordset
and
still get the error... Anyone have an idea?

Thanks!

You're welcome!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top