i have a vb 6 access 2000 DB. this is my sql query:
everything works but the order by gives me results like thisCode:rs.Open "Select count(Format(visitdate,'mm-yyyy')) AS TheDate, Format(visitdate,'mm-yyyy') " & _ "as MonthYear From Visitors Group BY Format(visitdate,'mm-yyyy') ORDER BY MONTH(Format(visitdate,'mm-yyyy')) ASC, " & _ "YEAR(Format(visitdate,'mm-yyyy')) DESC", conn, adOpenForwardOnly, adLockReadOnly Do Until rs.EOF Print #FileNumber, "Month/Year:"; Tab(21); rs.Fields("MonthYear").Value & "" Print #FileNumber, "Number Of Visitors:"; Tab(21); Format(rs.Fields("TheDate").Value & "", "###,##0")
Month/Year: 01-2011
Number Of Visitors: 8,826
_________________________________
Month/Year: 02-2011
Number Of Visitors: 8,455
__________________________________
Month/Year: 03-2011
Number Of Visitors: 9,070
__________________________________
Month/Year: 04-2011
Number Of Visitors: 9,500
__________________________________
Month/Year: 05-2011
Number Of Visitors: 4,615
__________________________________
Month/Year: 11-2010
Number Of Visitors: 5,699
___________________________________
Month/Year: 12-2010
Number Of Visitors: 7,180
i messed around with asc and desc for both and cant get want i want which is like this
5-2011
4-2011
3-2011
2-2011
1-2011
12-2010
11-2010




Reply With Quote