Too few paramaters

B

BobRoyAce

I have a query that, when I attempt to execute using code
(e.g. Set rs = CurrentDB.OpenRecordset(...)), I get a
message indicating "Too few parameters. Expected 0." If
zero are expected, then how is it too few!? What does
this error mean. Queries involved are shown below. NOTE:
ARM is one of values returned for Team in
NewReportQuery1Year.

------- Query -------
SELECT NewReportQuery1Year.FunctionalCategoryDesc,
NewReportQuery1Year.ARM
FROM NewReportQuery1Year
ORDER BY NewReportQuery1Year.FunctionalCategoryDesc

------- NewReportQuery1Year ------
PARAMETERS [Forms]![Reporting]![FiscalYear] IEEEDouble;
TRANSFORM Sum([Raw Downtime Data With Detail].[Time
(min)]) AS LostTime
SELECT FunctionalCategories.FunctionalCategoryDesc
FROM [Raw Downtime Data With Detail] INNER JOIN
(FunctionalCategories INNER JOIN Categories ON
FunctionalCategories.FunctionalCategoryCd =
Categories.FunctionalCategoryCd) ON [Raw Downtime Data
With Detail].[Category Type] = Categories.Category
WHERE [Raw Downtime Data With Detail].[Fiscal Year] =
[Forms]![Reporting]![FiscalYear]
GROUP BY FunctionalCategories.FunctionalCategoryDesc
PIVOT [Raw Downtime Data With Detail].Team;
 
A

Allen Browne

Not sure what the zero is about, but clearly your query does require one
parameter.

The interfaces uses the Expression Service to resolve the reference to the
text box, but DAO cannot do that. You could assign the parameter like this:

Dim qdf as DAO.QueryDef
Set qdf = dbengine(0)(0).QueryDefs("NameOfYourQueryHere")
qdf.Parameters(0)= Forms!Reporting!FiscalYear
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