Chart sort

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Chart sort

Post by Egg 'n' Bacon »

Well I'm back again.

I know I've had this before, but no memory of how or where I have the solution.

In a nutshell; I have a query that has a sort by month-year. The chart however sorts this alphabetically :groan:

Ideas please?

User avatar
HansV
Administrator
Posts: 78676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart sort

Post by HansV »

Can you format the date as yy-mm or yyyy-mm?
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Chart sort

Post by Egg 'n' Bacon »

The query is in date format (though I tried mm-yyyy too) & sorts appropriately, but the chart still re-sorting to alphabetical.

User avatar
HansV
Administrator
Posts: 78676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart sort

Post by HansV »

Try replacing the date field with a calculated column

Format([DateField],"yyyy-mm")

where DateField is the name of the date field.

Explanation: The Chart Wizard in Access tends to create a crosstab query from the query you provide. The column field of a pivot table is treated as text, even if it is a date field.
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Chart sort

Post by Egg 'n' Bacon »

Didn't quite get that, but it got me looking in the row source for the chart. That was quite an education!

What I tried (that worked :clapping: ) was replacing the SQL with that of the query. Now it works.

Cheers hans :thankyou:

User avatar
HansV
Administrator
Posts: 78676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart sort

Post by HansV »

Good for you!
Best wishes,
Hans