By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Recordset Error

P: n/a
Hi and TIA! I have a query that uses 2 values from my form as criteria for
2 fields in the query. I can select the options and open the query. I can
base a form on the query and launch it from my criteria form with no
problem. However if I try to open a recordset object against the query from
this same criteria form I receive the (error # 3061 Too few parameters.
expected 2.). I've tried first opening the query from code, which worked
fine, then building my recordset, but received the same error. Any help is
appreciated.

Set db = CurrentDb()
Set rst1 = db.OpenRecordset("select * From [qryMyQry]")

--
Reggie

"Half this game is 90% mental."

----------
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sun, 28 Sep 2003 00:10:28 -0600 in comp.databases.ms-access,
"Reggie" <newsgroups@no_spam.comcast.net> wrote:
Hi and TIA! I have a query that uses 2 values from my form as criteria for
2 fields in the query. I can select the options and open the query. I can
base a form on the query and launch it from my criteria form with no
problem. However if I try to open a recordset object against the query from
this same criteria form I receive the (error # 3061 Too few parameters.
expected 2.). I've tried first opening the query from code, which worked
fine, then building my recordset, but received the same error. Any help is
appreciated.

Set db = CurrentDb()
Set rst1 = db.OpenRecordset("select * From [qryMyQry]")


In DAO you have to open the query and set the parameters, e.g.

Set qdf = db.QueryDefs("qryMyQry")
qdf.parameters("nameofparameter1")=valueofparamete r1
qdf.parameters("nameofparameter2")=valueofparamete r2
set rst1=qdf.OpenRecordset()
....
--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #2

P: n/a
I see said the blind man. Thanks Trevor!

--
Reggie

"Half this game is 90% mental."

----------
"Trevor Best" <bouncer@localhost> wrote in message
news:i8********************************@4ax.com...
On Sun, 28 Sep 2003 00:10:28 -0600 in comp.databases.ms-access,
"Reggie" <newsgroups@no_spam.comcast.net> wrote:
Hi and TIA! I have a query that uses 2 values from my form as criteria for2 fields in the query. I can select the options and open the query. I canbase a form on the query and launch it from my criteria form with no
problem. However if I try to open a recordset object against the query fromthis same criteria form I receive the (error # 3061 Too few parameters.
expected 2.). I've tried first opening the query from code, which worked
fine, then building my recordset, but received the same error. Any help isappreciated.

Set db = CurrentDb()
Set rst1 = db.OpenRecordset("select * From [qryMyQry]")


In DAO you have to open the query and set the parameters, e.g.

Set qdf = db.QueryDefs("qryMyQry")
qdf.parameters("nameofparameter1")=valueofparamete r1
qdf.parameters("nameofparameter2")=valueofparamete r2
set rst1=qdf.OpenRecordset()
...
--
A)bort, R)etry, I)nfluence with large hammer.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.