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

Does sorting a DAO.Recodset actually do anything? 1

Status
Not open for further replies.

ponderdj

MIS
Dec 10, 2004
135
US
Hi,

I have a form that uses sets a DAO.Recordset from a DAO.QueryDef. That recordset is then used to populate a Treeview. I want to set the recordset once, then use a recordsetclone and sort it based on different fields to repopulate the treeview.

I've used
Code:
rst.Sort = "[Field] Asc"
but it doesn't seem to sort the field at all, I've checked using debug.print and by looking at how it populates the treeview... it seems random.

Thanks
 
You have to use another recordset:
With rst
.Sort = "[Field] Asc"
Set rstSorted = .OpenRecordset
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's it! Thanks PHV. Man, I was almost there, I just forgot to change the rst that gets passed to my treeview populating function. At least I was on the right path...

Thanks again, PHV.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top