Sort DatePart in crosstab query

  • Thread starter Thread starter BruceM
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top