Too few parameters in report_open using crosstab query

M

Mark Hammer

Using a report with a crosstab query as the recordsourse. Query runs fine
in db window and report will open with the data ok.

Now trying to dynamically assign control properties in the report_open
event, where I do this:

Dim rs as DAO.Recordset
Set rs = CurrentDb.OpenRecordset(Me.RecordSource)

Here is where I get the error, "3061 -- Too few parameters. Expected 2"

My two parameters are declared in the xtab query. I can dim a qdf, set it
to my recordsource query, retrieve the sql at runtime, paste it into a new
query, and it works fine.

Stumped here. Help appreciated.

Mark Hammer
Lake Oswego, Oregon, U.S.
 
M

Mark Hammer

Further info:

When I use an ADO recordset instead of a DAO recordset, I get a different
error, namely:

-2147217904 'No value given for one or more required parameters.

Still puzzling . . .

--Mark Hammer
 
M

Mark Hammer

Solved:

Thanks to a post on 9/19/2005 by David to
microsoft.public.access.modulesdaovba

which included this info:

==================
Using DAO objects, you have to evaluate the Application
references first, for example like this:


dim qdf as dao.querydef
dim db as dao.database


set db = currentdb
set qdf = db.querydefs("MyQueryName")
qdf.parameters("[Forms]![myForm]![controlName]") = me.controlName


set rs = qdf.OpenRecordset
 

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

Top