-----Original Message-----
Hi Mayra,
The problem isn't that it's a Totals query. I suspect that, rather than
a standard Date/Time field in your table, you have a text field
containing the names of the months (hopefully NOT named "Month," as this
is a reserved word in Access...you'll see why in a sec). So of course,
if you sort on this field, Access sorts it alphabetically: April comes
before August; December comes before February, etc.. If you want your
results sorted in order of ascending month (Jan-Dec), you have to use
the month's number, not the text name. The easiest way to do this is to
use the MONTH() function on a Date/Time field:
SELECT MONTH([CallDate]) AS CallMonth, SUM([Calls]) AS NumCalls
FROM YourTable
GROUP BY CallDate
ORDER BY MONTH([CallDate]) ASC;
To reproduce exactly your example data, add a YEAR() function to the
query:
SELECT YEAR([CallDate]) AS ServiceYear, MONTH([CallDate]) AS CallMonth,
SUM([Calls]) AS NumCalls
FROM YourTable
GROUP BY CallDate
ORDER BY YEAR([CallDate]),MONTH([CallDate]) ASC;
This will sort calls by year (earliest to most recent), and then by
months within each year (1-12).
Use the FORMAT() function to display the month by name:
SELECT Year([CallDate]) AS ServiceYear, Format(Month ([CallDate]),"mmmm")
AS CallMonth, SUM([Calls]) AS NumCalls
FROM YourTable
GROUP BY CallDate
ORDER BY Year([CallDate]), Format(Month ([SampleDate]),"mmmm") ASC;
If your months are already "hard-coded" in your table, you could run a
quick series of Update queries to change the names to numbers.
hth,
LeAnne
I have created a summary query that totals the number of
calls for each month but I can't sort it by month because
if I do it sorts it in alphabetical order instead of by
month. Can you help? Could it be because it's a summary?
Month
August 2004
July 2004
June 2004
May 2004
September 2004
.