PDA

Click to See Complete Forum and Search --> : SELECT ORDER BY with ADO


Jimmer
Jun 15th, 2000, 12:16 AM
I want to be able to order my records by the day of the week. Meaning I want to sort by date, but just by the day of the week, all Monday's together, all Tuesdays together,etc.

With DAO I could use the recordset property sort.
Like This:

temprecset.sort = "WeekDay(Date)"

Using the VB function WeekDay.

But with ADO I can't use the sort function.

Any ideas??????

Thanks in advance.

I figured it out myself. I didn't realize that you could just insert the VB Function right into the Select statement itself and it would work fine.

Thanks anyway


[Edited by Jimmer on 06-15-2000 at 02:53 PM]

JHausmann
Jun 15th, 2000, 01:55 AM
According to the HitchHikers Guide to VB and SQL server:
"The sort property [of an ADO recordset] specifies how to order the rows in the recordset. This property is a string of comma-delimited Field names separated by an optional space and ASCENDING or DESCENDING. Actually, ADO seems to prefer DESC and ASC but this might be a bug".

an example given:

RS.Sort = "title, DESC, pub_ID" for the pubs.Titles table in SQL Server.