Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crosstab sorting

Status
Not open for further replies.

jommyjet

Technical User
May 19, 2003
49
US
I have a crosstab query that breaks out monthly totals, but I'd like a more decriptive nanme for the column heading than 1/1/2003. I have a field containing a text value jan2003 and I'd like to use that as a heading, but access sorts the column headings by the text value so apr2003 is ahead of jan2003. Is there a way to display the text field, but sort by the date field? thanks
 
i imagine this can be posed as a renaming question. can I rename crosstab column headings?
 
Utilize the IN clause of the PIVOT statement. This can be used to do two things, limit/define the columns that will be printed, and control the order they are displayed. So, you could do something like this:
Code:
PIVOT TableName.FieldName In ('jan2003', 'feb2003', 'mar2003', ....etc.);
 
Working from another alley, you can first make a select query which does all the "column heading" formatting for you, i.e. add a field which you call

ColHeader: Format([mydatefld],"mmmyyyy")


Then have the crosstab query pull its data from this new query and you will have your formatted headers.

--
Find common answers using Google Groups:

Corrupt MDBs FAQ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top