|
|
the date referenced below in code is sorting like.... September08 September07 October08 October07
instead of..... October08 September08 October07 September07
Private Sub List13_Click()
List15.RowSource = "SELECT Format((DateDep),'mmmmyy'), Format(SUM(Amount),'currency'), Account FROM Deposits WHERE (Account='" & List13 & "') GROUP BY Format((DateDep),'mmmmyy'), Account ORDER BY Format((DateDep),'mmmmyy') DESC;"
End Sub
I want it to sort by date and not like a string text or number....any ideas???
|
|
Also, the table format is in Date/Time where the datasheet reflects 11/25/08
"Gator" wrote:
[Quoted Text] > the date referenced below in code is sorting like.... > September08 > September07 > October08 > October07 > > instead of..... > October08 > September08 > October07 > September07 > > Private Sub List13_Click() > > List15.RowSource = "SELECT Format((DateDep),'mmmmyy'), > Format(SUM(Amount),'currency'), Account > FROM Deposits > WHERE (Account='" & List13 & "') > GROUP BY Format((DateDep),'mmmmyy'), Account > ORDER BY Format((DateDep),'mmmmyy') DESC;" > > End Sub > > I want it to sort by date and not like a string text or number....any ideas??? >
|
|
On Tue, 25 Nov 2008 08:23:02 -0800, Gator wrote:
[Quoted Text] > the date referenced below in code is sorting like.... > September08 > September07 > October08 > October07 > > instead of..... > October08 > September08 > October07 > September07 > > Private Sub List13_Click() > > List15.RowSource = "SELECT Format((DateDep),'mmmmyy'), > Format(SUM(Amount),'currency'), Account > FROM Deposits > WHERE (Account='" & List13 & "') > GROUP BY Format((DateDep),'mmmmyy'), Account > ORDER BY Format((DateDep),'mmmmyy') DESC;" > > End Sub > > I want it to sort by date and not like a string text or number....any ideas???
ORDER BY DateDep DESC; -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
makes good sense...but List15 is blank on List13 click.
"fredg" wrote:
[Quoted Text] > On Tue, 25 Nov 2008 08:23:02 -0800, Gator wrote: > > > the date referenced below in code is sorting like.... > > September08 > > September07 > > October08 > > October07 > > > > instead of..... > > October08 > > September08 > > October07 > > September07 > > > > Private Sub List13_Click() > > > > List15.RowSource = "SELECT Format((DateDep),'mmmmyy'), > > Format(SUM(Amount),'currency'), Account > > FROM Deposits > > WHERE (Account='" & List13 & "') > > GROUP BY Format((DateDep),'mmmmyy'), Account > > ORDER BY Format((DateDep),'mmmmyy') DESC;" > > > > End Sub > > > > I want it to sort by date and not like a string text or number....any ideas??? > > ORDER BY DateDep DESC; > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail >
|
|
When you format the date you are converting it to text so it sorts alphabetically. To do what you want add another column to sort by and set it's width in the list box to zero so that it cannot be seen:
List15.RowSource = "SELECT Format(DateDep,'yyyymm'), Format(DateDep,'mmmm yy'), Format(SUM(Amount),'currency'), Account FROM Deposits WHERE Account='" & List13 & "' GROUP BY Format(DateDep,'yyyymm'), Format(DateDep,'mmmm yy'), Account ORDER BY Format(DateDep,'yyyymm') DESC"
HTH John ################################## Don't Print - Save trees
Gator wrote:
[Quoted Text] > the date referenced below in code is sorting like.... > September08 > September07 > October08 > October07 > > instead of..... > October08 > September08 > October07 > September07 > > Private Sub List13_Click() > > List15.RowSource = "SELECT Format((DateDep),'mmmmyy'), > Format(SUM(Amount),'currency'), Account > FROM Deposits > WHERE (Account='" & List13 & "') > GROUP BY Format((DateDep),'mmmmyy'), Account > ORDER BY Format((DateDep),'mmmmyy') DESC;" > > End Sub > > I want it to sort by date and not like a string text or number....any ideas???
|
|
|