Too few parameters expected one (1 Viewer)

aman

Registered User.
Local time
Today, 12:29
Joined
Oct 16, 2008
Messages
1,250
Hi there


I am getting runtime error 3061. Too few parameters expected one in the following line of code. The query itself works absolutely fine.

Code:
Set rs = CurrentDb.OpenRecordset("qry_FormsCat_CallAudit_CustomerOutcome")

Any help will be much appreciated.

Thanks
 

Ranman256

Well-known member
Local time
Today, 15:29
Joined
Apr 9, 2015
Messages
4,337
if this is a crosstab query and it references form objects, you MUST enter parameters
(via query design, parameters button, set refs: forms!myForm!txtBox , short text)

is it a crosstab?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 20:29
Joined
Feb 19, 2013
Messages
16,612
it may be your query references a form for criteria - which you can't do when opening a recordset.

if this is the case, either build the full query sql in vba or remove the criteria in the query which relates to a form and put into your vba code e.g.

Set rs = CurrentDb.OpenRecordset("SELECT * FROM qry_FormsCat_CallAudit_CustomerOutcome WHERE somefield = " & forms!myForm!myControl)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:29
Joined
May 7, 2009
Messages
19,242
And if it is an action query use

Currentdb.Execute
 

Users who are viewing this thread

Top Bottom