Access errors out when query by ascending

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

John Spencer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top