Discussion Locked

MS Access Crosstab/Parameter Queries

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm writing a crosstab query but I want the user to input the date. In a simple SELECT query, you simply say, "WHERE Date = [ENTER DATE]." However, in an equivalent Crosstab Query, I get the error, "The Microsoft Jet Engine does not recognize [ENTER DATE] as a valid field name or expression."
What is different about pivot queries? Any work-arounds? I've tried putting the user-entry parameter in a sub-query with the same result.

TRANSFORM Sum(m.Monthly_Total) AS Total
SELECT m.division
FROM tbl_Mthly_Data AS m
WHERE m.as_of_date=[enter date:]
GROUP BY m.division
PIVOT m.as_of_date;

1 reply

by juddly

Simple Answer found:

PARAMETERS [enter date:] DateTime;
TRANSFORM Sum(m.Monthly_Total) AS Total
SELECT m.division
FROM tbl_Mthly_Data AS m
WHERE m.as_of_date=[enter date:]
GROUP BY m.division
PIVOT m.as_of_date;

This discussion is closed to new replies.