rudeboymcc
Registered User.
- Local time
- Yesterday, 22:27
- Joined
- Sep 9, 2008
- Messages
- 69
Hi. I'm writing a query in vba (first time) and i've got the recordset i want, but i'm having trouble sorting it by the date.
I've created a Date (Dim CurrentDate As Date), and assigned it liek this:
i'm putting CurrentDate into the sql query like this:
and the Order by clause:
Problem is, it orders it first by the date, then month, then year. I need it reversed, to order it by year, month then date.
anyone have any ideas? I could just change dd/mm/yyyy to yyyy/mm/dd but thats not very user friendly
I've created a Date (Dim CurrentDate As Date), and assigned it liek this:
Code:
CurrentDate = DateAdd("m", 1, Me.ContractStartDate)
i'm putting CurrentDate into the sql query like this:
Code:
strSql = "SELECT Tenancies.ID, Tenancies.Rent, Tenancies.ContractStartDate As PeriodFrom, Format('" & CDate(CurrentDate) & "', 'dd/mm/yyyy') AS PeriodTo,
and the Order by clause:
Code:
ORDER BY PeriodTo;
Problem is, it orders it first by the date, then month, then year. I need it reversed, to order it by year, month then date.
anyone have any ideas? I could just change dd/mm/yyyy to yyyy/mm/dd but thats not very user friendly
