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 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