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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab Column Sorting

Status
Not open for further replies.

GummowN

Programmer
Jul 26, 2002
157
0
0
GB
I have a crosstab query that returns monthly results for the last year. The query runs OK and produces the correct results. However the only thing that needs changing is the order of the columns. I have tried everything I can think of but the columns always appear chronologically eg 10/01, 11/01, 12/01 ....09/02, 10/02. Does anyone know a method of displaying the columns in reverse order eg 10/02, 09/02, 08/02 ...... 11/01, 10/01.

All help is welcome and thanks in advance
 
Solved my own problem here by changing the format of the column header.
"mmm/yy" Works OK
"mmm yy" Works OK
"mm yy" Works OK
"mm/yy" Will not not change the ordering based on an order by statement

 
Have you tried going into Query Design and moving the columns into the order you want them displayed?
 
Open your query and right click on the properties for the date, type in the order you want the columns. Ie I Use mmm-yy as a format and I paste the following into the area for column headings, "Jan-01","Feb-01","Mar-01","Apr-01","May-01","Jun-01","Jul-01","Aug-01","Sep-01","Oct-01","Nov-01","Dec-01","Jan-02","Feb-02","Mar-02","Apr-02","May-02","Jun-02","Jul-02","Aug-02","Sep-02","Oct-02". if you use "mm-yy" then use "01-01", "02-01" etc
 
Because the query returns only the last 12 months, and is used monthly the column headers change.

As you can see from second post it only fails when the column is formatted as mm/yy. All the other formats work without a problem.

I have changed to mmm yy format and ordered the columns DESC and it works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top