Crosstab 12 months doubling up on a month (1 Viewer)

kentwood

Registered User.
Local time
Today, 13:15
Joined
Aug 18, 2003
Messages
51
Have a crosstab query for a running 12 months that is used for a report and I noticed today that each month is correct except that it is also picking up Feb of last year as well as this year. All other months are good. No other pre-queries have any date ranges in them. Anyone know what I have to do to prevent this problem? Below is my SQL.:confused:

TRANSFORM Sum([92660ScorecardUnionName].Hrs) AS SumOfHrs
SELECT [92660ScorecardUnionName].EMPID, [92660ScorecardUnionName].Category, [92660ScorecardUnionName].OPID, [92660ScorecardUnionName].NAME, [92660ScorecardUnionName].Description, Avg([92660ScorecardUnionName].Hrs) AS [Avg Of Hrs]
FROM 92660ScorecardUnionName
GROUP BY [92660ScorecardUnionName].EMPID, [92660ScorecardUnionName].Category, [92660ScorecardUnionName].OPID, [92660ScorecardUnionName].NAME, [92660ScorecardUnionName].Description
PIVOT Format([Date],"mmm") In ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:15
Joined
Feb 19, 2002
Messages
43,655
You have no criteria. If you want to select data for only one year, you must use selection criteria. How is Access to know that you want this year's data but not last year's unless you tell it?
 

Jon K

Registered User.
Local time
Today, 18:15
Joined
May 22, 2002
Messages
2,209
For crosstab queries, when you add the criteria, you also need to declare the data type of each criteria parameter (Open the query that contains the parameter(s) in query Design view, choose menu Query, Parameters..., type each parameter and select its correct data type. Then click OK.)
.
 

Users who are viewing this thread

Top Bottom