open recordset sort order

  • Thread starter Thread starter CN
  • Start date Start date
C

CN

Is there a way that I can sort the results that the
records are returned when using CurrentDb.OpenRecordset
("MyTable").

I have a field in 'MyTable' that I want to use to drive
this sort order so I can loop through the record set based
on that field.

Any ideas would be really appreciated. Thx!
 
The trick is to use an SQL query rather than the table itself in the
recordset definition, and do the sorting in the query, e.g.

strSQL = "SELECT * FROM MyTable ORDER BY MyField"
set rst = CurrentDb.OpenRecordset(strSQL)

HTH,
Nikos
 
Back
Top