condition in crosstab of a query won't work - why? (1 Viewer)

Scatter

Registered User.
Local time
Today, 11:56
Joined
Dec 19, 2012
Messages
11
I have a crosstab query that runs fine until I try to attach a WHERE condition to it. The data for it is another query that joins names with their hours:

SELECT Hours.VolunteerID, Hours.Program, Hours.Hours, Contacts.LastName, Contacts.FirstName, Year([VolDate]) AS [Year]
FROM Contacts INNER JOIN Hours ON Contacts.[ID] = Hours.[VolunteerID];

My understanding is that I need to start with this joining query to get the data from two tables together, before a crosstab would work.

My crosstab query is:

TRANSFORM Sum(qryIndivHours.Hours) AS SumOfHours
SELECT qryIndivHours.FirstName, qryIndivHours.LastName, Sum(qryIndivHours.Hours) AS [Total Of Hours]
FROM qryIndivHours
GROUP BY qryIndivHours.FirstName, qryIndivHours.LastName
PIVOT qryIndivHours.Program;

This works fine. But I need to be able to select just individual years.
When I add
WHERE (((qryIndivHours.Year)=[what year]))
I get the following error -
"The Access database engine does not recognize '[what year]' as a valid field name or expression."

It's probably something stupid, but what am I missing???
 

Users who are viewing this thread

Top Bottom