Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort some by ascending and some by descending

Status
Not open for further replies.

chris9

Programmer
Feb 11, 2003
32
US
I have the following code that sorts the table in ascending order by MakeName, ModelName, and VIN

rst.Open "Select * From " & tnm & " Order By MakeName, ModelName, VIN", CurrentProject.Connection, adOpenStatic, adCmdText
'tnm is my table name

I want to now add two more fields EffYear and EffMonth and have those then sorted in descending order.

How do I sort in both ascending and descending order?
 
chris:

Write the SQL like this:

rst.Open "Select * From " & tnm & " Order By MakeName, ModelName, VIN, EffYear DESC, EffMonth DESC", CurrentProject.Connection, adOpenStatic, adCmdText


That should do it.

HTH,

Vic
 
Thanks you. I tried it with the () and [] but never tired it without them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top