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

Sorting Chart

Status
Not open for further replies.

fredk

Technical User
Jul 26, 2001
708
US
I have a query that links together a date in month format so the result is 1 or 2 etc. This query links a month table to get the month name such as jan, feb, etc.

I previously set up a chart to show the month and I uses the month number as the sort order so the months were in correct order on the chart.

I am now trying to change the sort order of the chart to a new field I created that contains the year and month so the results are 200212, 20031, 20032. This way I can use dates from different years.

My problem is with the sql. Here is the sql I had for the chart:

SELECT [Month],Sum([CountOfID Num]) AS [SumOfCountOfID Num] FROM [qryMonthlyTracking2] GROUP BY qryMonthlyTracking2.MonthNumber, qryMonthlyTracking2.Month ORDER BY qryMonthlyTracking2.MonthNumber;

I want to change the order by to my field called "sortby" - This "sortby" field is in the query "qryMonthyTracking2" as such:

"SortBy: ([year] & [monthnumber])"

I tried to change the order by to:

"ORDER BY qryMonthlyTracking2.MonthNumber;"

but I received an error "You tried to execute a query that doesnt include the specified expression 'qrymonthlytracking2.sortby' as part of an aggregate function"

Do I need to seperate the two fields in the sql somehow?

Thanks much for the help!!!!

Fred

 
I figured out my problem - I did not add "qryMonthlyTracking2.SortBy" under the "Group By" in the sql.

Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top