Crosstab Query Column Headings

G

Guest

My underlining query returns results in the NewDate column from between
[forms]![Pick_Super_Chart]![cmdBegin] and
[forms]![Pick_Super_Chart]![cmdend]. I need my crosstab query to show column
headings for each month between those two dates like Jan/05, Feb/05 . . .
instead of M0, M1, M2, etc. I've tried everything with no success. I've
research enough to know that I probably need some code to do this, but I
don't know where to start. Does anyone have some sample code that will
return crosstab column headings results to the months the user picks on the
Pick_Super_Chart form? Thank you.

TRANSFORM Max(Super_D1Tots_Q1.[Day 1 Performance]) AS [MaxOfDay 1 Performance]
SELECT Super_D1Tots_Q1.[RCD LOC]
FROM Super_D1Tots_Q1
GROUP BY Super_D1Tots_Q1.[RCD LOC]
PIVOT "M" & DateDiff("m",[forms]![Pick_Super_Chart]![cmdBegin],[NewDate]) In
("M0","M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11");
 
G

Guest

Your problem is in --
PIVOT "M" & DateDiff("m",[forms]![Pick_Super_Chart]![cmdBegin],[NewDate]) In
("M0","M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11");

You are subtracting two dates and displaying the difference in number of
months. This will not display month/year.
 
D

Duane Hookom

Try:
PIVOT Format([NewDate], "mmm/yy");

However, this will create dynamic column headings based on the retrieved
dates.
 

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