Access errors out when query by ascending

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

I have the below code in my query and want it to sort by ascending not
descending.

Everytime i change it to Ascending in the design view not the code view
Access encounters an error and must close. can you help me rewrite the code
so it is ascending rather than descending. I do not know code so if you
could provide me a copy and paste code i can handle that.

SELECT Q.FTE_DATE_YM, (SELECT COUNT(*) FROM [qry_AvailableReportingMonths] Q1
WHERE Q1.FTE_DATE_YM > Q.FTE_DATE_YM)+1 AS Rank, "Month_0" & [Rank] AS
Format1, Left([Format1],6) & Right([Format1],2) AS [Month]
FROM qry_AvailableReportingMonths AS Q
ORDER BY Q.FTE_DATE_YM DESC;
 
Usually when this type of thing happens I find that the base query is
generating an error in the field I am trying to order by.

Is FTE_DATE_YM a calculated field in qry_AvailableReportingMonths?

IF so is the expression handling non-date and null values correctly or is it
generating an error somewhere?

Post the sql for qry_AvailableReportingMonths so we can see what it is doing.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top