I'm running a rather simple query with a parameter, so that in a report, the user can enter the year and a chart will display data from said year.
If I hard-code in the year, like this:
"All Parts" AS `Product Part Number`,
Month(`DateReworked`) AS Mo,
Year(`Datereworked`) AS Yr,
Avg(tblReworkRecords.DaysToRework) AS AvgOfElapsedDays
(`Product part number List`
INNER JOIN `Shop Order List`
ON `Product part number List`.`Product Part Number` = `Shop Order List`.`Product Part Number`)
INNER JOIN tblReworkRecords
ON `Shop Order List`.`Shop Order Number` = tblReworkRecords.ShopOrderNumber
((Year(tblReworkRecords.Datereworked) = 2010))
GROUP BY Month(`DateReworked`)
HAVING (((Avg(tblReworkRecords.DaysToRework)) Is Not Null))
Order BY `Product Part Number`, Mo, AvgOfElapsedDays
I get exactly what I am looking for for 2010 (12 rows, 1 for each month)
However if I used the EXACT same code, only where it says ((Year(tblReworkRecords.Da
) = 2010)), I change it to ((Year(tblReworkRecords.Da
) = @Year)) , and run the query (it prompts me to enter a year for the parameter, and I type in 2010), I get absolutely no rows of data, none at all.
Does anyone know what I am doing wrong or why I am getting no data?
Thank you in advance.