In Access2010, I have a crosstab report (monthly sum of hours by program) that runs off a button (OnClick event macro) on a main menu form. The data source is a query with the following SQL:
TRANSFORM Sum(Hours.Hours) AS SumOfHours
SELECT Hours.Program, Sum(Hours.Hours) AS [Total Hours]
FROM Hours
WHERE (((Year([VolDate]))=[What year?]))
GROUP BY Hours.Program
PIVOT Format([VolDate],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
All runs well, but I want the year entered by the user to print in the report.
How can I pass the WHERE condition value entered by the user (a year) to be printed in the report?
TRANSFORM Sum(Hours.Hours) AS SumOfHours
SELECT Hours.Program, Sum(Hours.Hours) AS [Total Hours]
FROM Hours
WHERE (((Year([VolDate]))=[What year?]))
GROUP BY Hours.Program
PIVOT Format([VolDate],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
All runs well, but I want the year entered by the user to print in the report.
How can I pass the WHERE condition value entered by the user (a year) to be printed in the report?