set report fields

G

Guest

I have a report from a crosstab in which I have month's accross the top, and
percentages by employee as rows. Here is the SQL of the query:

TRANSFORM Avg([PRODUCTIVE_TIME]/[STAFF_TIME]) AS Expr1
SELECT MastrPhoneStatsTbl.USERID, MastrPhoneStatsTbl.LASTNAME,
MastrPhoneStatsTbl.FIRSTNAME, MastrPhoneStatsTbl.TEAM_NAME
FROM MastrPhoneStatsTbl
WHERE (((MastrPhoneStatsTbl.TEAM_NAME) Like "CC TEAM*"))
GROUP BY MastrPhoneStatsTbl.USERID, MastrPhoneStatsTbl.LASTNAME,
MastrPhoneStatsTbl.FIRSTNAME, MastrPhoneStatsTbl.TEAM_NAME
PIVOT Month(MastrPhoneStatsTbl!DATE);

I am pivoting by Month, so the data looks like this

1 2 3 4
John Smith 90% 80% 90% 91%

My problem is I want all of the months of the year to show up in the report
even if there is no data for them yet (so I don't have to keep manually
adding fields in the report). Is there a way to do this?

Thanks!
 
A

Allen Browne

Open your crosstab query in design view.
Open the Properties box (View menu).
Enter all the valid values beside the Column Headings property:
1, 2, 3, ... 12
 
J

John Spencer

Try adding the known column values to the query

TRANSFORM Avg([PRODUCTIVE_TIME]/[STAFF_TIME]) AS Expr1
SELECT MastrPhoneStatsTbl.USERID, MastrPhoneStatsTbl.LASTNAME,
MastrPhoneStatsTbl.FIRSTNAME, MastrPhoneStatsTbl.TEAM_NAME
FROM MastrPhoneStatsTbl
WHERE (((MastrPhoneStatsTbl.TEAM_NAME) Like "CC TEAM*"))
GROUP BY MastrPhoneStatsTbl.USERID, MastrPhoneStatsTbl.LASTNAME,
MastrPhoneStatsTbl.FIRSTNAME, MastrPhoneStatsTbl.TEAM_NAME
PIVOT Month(MastrPhoneStatsTbl!DATE) IN (1,2,3,4,5,6,7,8,9,10,11,12)
 
G

Guest

Wow, that was easy. Thanks!!!

Allen Browne said:
Open your crosstab query in design view.
Open the Properties box (View menu).
Enter all the valid values beside the Column Headings property:
1, 2, 3, ... 12

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Nick I said:
I have a report from a crosstab in which I have month's accross the top,
and
percentages by employee as rows. Here is the SQL of the query:

TRANSFORM Avg([PRODUCTIVE_TIME]/[STAFF_TIME]) AS Expr1
SELECT MastrPhoneStatsTbl.USERID, MastrPhoneStatsTbl.LASTNAME,
MastrPhoneStatsTbl.FIRSTNAME, MastrPhoneStatsTbl.TEAM_NAME
FROM MastrPhoneStatsTbl
WHERE (((MastrPhoneStatsTbl.TEAM_NAME) Like "CC TEAM*"))
GROUP BY MastrPhoneStatsTbl.USERID, MastrPhoneStatsTbl.LASTNAME,
MastrPhoneStatsTbl.FIRSTNAME, MastrPhoneStatsTbl.TEAM_NAME
PIVOT Month(MastrPhoneStatsTbl!DATE);

I am pivoting by Month, so the data looks like this

1 2 3 4
John Smith 90% 80% 90% 91%

My problem is I want all of the months of the year to show up in the
report
even if there is no data for them yet (so I don't have to keep manually
adding fields in the report). Is there a way to do this?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top