Search notes:

Access: DoCmd.SetOrderBy

DoCmd.SetOrderBy specifies the columns whose values specify the order of records (sort) in the table, form, report or datasheet that is active and has the focus.
Sort by (ascending) articleId:
doCmd.SetOrderBy "articleId"
Sort by multiple columns (reportYear and reportMonth):
doCmd.SetOrderBy "reportYear, reportMonth"
setOrderBy understands the desc key word (which reverses sort order):
doCmd.setOrderBy "eventDate desc"

Making a table active

A table becomes active by calling
doCmd.openTable "contracts"

doCmd.setOrderBy …

See also

DoCmd.ApplyFilter allows to select a subset of records. It roughly corresponds to an SQL where condition.
The DoCmd object.

Index