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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW SORT 2 recordset ?

Status
Not open for further replies.

desprits

Programmer
Feb 14, 2004
40
CA
What should I do to sort two recordset ?

Exemple:
First SORT by DateUtilisation
Second SORT by HresDebutUtilisation

This don't working:
adoTriTemps.Recordset.Sort = "DateUtilisation ASC" And "HresDebutUtilisation ASC"
 
Probably better if you create a new recordset using an SQL statement from the first, try this...

[tt]

Sub SortByField()
Dim rstNewSorted as RecordSet
Dim SortDB as Database

Set SortDB = OpenDatabase("yourdb.mdb") 'Your Database Path

Set rstNewSorted = SortDB.OpenRecordSet("SELECT * " & _
"FROM YourTable ORDER BY " & _
"'DateUtilisation ASC', 'HresDebutUtilisation ASC'", _
dbOpenDynaset)

SortDB.Close
End Sub
[/tt]

Hope this helps.


jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 

adoTriTemps.Recordset.Sort = "DateUtilisation ASC, HresDebutUtilisation ASC"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top