Sort DatePart in crosstab query

B

BruceM

A column heading in a crosstab query is a DatePart rendering of the month:

MonthRange: DatePart("m",[DateField])

This works as it should, but I wonder if instead of have 1, 2, 3, etc. as
column heading it is possible to have this appear as "Jan", "Feb", etc.,
sorted in the correct calendar order. I realize it doesn't really matter
for forms and reports, but there are times where it would be convenient to
see the month names rather than numbers.
 
A

Allen Browne

You can do it if you use:
MonthRange: Format([DateField], "mmm")
and then set the Column Headings property of the query to:
"Jan"; "Feb"; "Mar"; ...
etc so they appear in the correct order.
 
B

BruceM

Thanks, Allen. That's pretty simple now that I see how it's done.

Allen Browne said:
You can do it if you use:
MonthRange: Format([DateField], "mmm")
and then set the Column Headings property of the query to:
"Jan"; "Feb"; "Mar"; ...
etc so they appear in the correct order.

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

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

BruceM said:
A column heading in a crosstab query is a DatePart rendering of the month:

MonthRange: DatePart("m",[DateField])

This works as it should, but I wonder if instead of have 1, 2, 3, etc. as
column heading it is possible to have this appear as "Jan", "Feb", etc.,
sorted in the correct calendar order. I realize it doesn't really matter
for forms and reports, but there are times where it would be convenient
to see the month names rather than numbers.
 

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