DAO Recordset Sort (1 Viewer)

CCIDBMNG

Registered User.
Local time
Yesterday, 18:46
Joined
Jan 25, 2002
Messages
154
I am trying to sort a recordset in VBA. I know you can use RS.Sort but I do not know the full snytax. Could someone please explain to me how this works and what the exact syntax is.


Thanks,
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:46
Joined
Feb 19, 2002
Messages
43,346
Why not just add an order by clause to the query that produced the recordset. SQL is MUCH more efficient than VBA code loops.
 

CCIDBMNG

Registered User.
Local time
Yesterday, 18:46
Joined
Jan 25, 2002
Messages
154
I took over a project that someone else was working on and for a report that we have it uses VBA to pull information into the report. And that query has criteria. It was giving an error when I did it that way. So I just referenced the table and used an IF statement for the criteria. But the way he has the code the table needs to be sorted for it to work right.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:46
Joined
Feb 19, 2002
Messages
43,346
From what you've said, there's no reason not to use a query with an order by clause. Try again, there must have been something wrong with your first attempt.
 

Users who are viewing this thread

Top Bottom