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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab parameter query error. Too few parameters. PLEASE HELP!!!!!

Status
Not open for further replies.
Jan 22, 2001
124
US
Hi


I keep getting a "Run-time error '3061' Too few parameters. Expected 2." error when attemting to run this code:

SQLstr2 = "PARAMETERS [Forms]![frmOperationsReports]![Low Year] Text, [Forms]![frmOperationsReports]![High Year] Text; TRANSFORM Count(TEST.CountOfRequestID) AS CountOfCountOfRequestID SELECT TEST.ClientRequestQuery.ClientInit FROM TEST WHERE Format([CommonRequestInfo]![RequestDate]," & "'" & "yyyy" & "'" & ") Between " & "'" & [Forms]![frmOperationsReports]![Low Year] & "'" & " And " & "'" & [Forms]![frmOperationsReports]![High Year] & "'" & " GROUP BY TEST.ClientRequestQuery.ClientInit PIVOT Format([CommonRequestInfo]![RequestDate]," & "'" & "yyyy" & "'" & ")"


I have been working on this for 2 days with no luck. I would GREATLY appreciate any help with this. I created the query using the design grid and copied the SQL code. The only changes I made were to include single quotes in the "Format" sections, and where the query gets the data entered on a form.

Thanks in advance for any help.

--Rob
 
Rob, try this:

SQLstr2 = "TRANSFORM Count(TEST.CountOfRequestID) AS CountOfCountOfRequestID SELECT TEST.ClientRequestQuery.ClientInit FROM TEST WHERE Format([CommonRequestInfo]![RequestDate], 'yyyy') Between '" & [Forms]![frmOperationsReports]![Low Year] & "' And '" & [Forms]![frmOperationsReports]![High Year] & "' GROUP BY TEST.ClientRequestQuery.ClientInit PIVOT Format([CommonRequestInfo]![RequestDate], 'yyyy')"

You don't need the "PARAMETERS..." part of the statement, as you're not prompting for parameters, you're passing the contents of 2 form fields to the query statement as parameters.

HTH...

--
Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top