From Microsoft Help pages:
You can also set the OrderByOn property for either forms or reports by using VBA.
The following code example sorts the active datasheet, form, report, or table by LastName descending and FirstName ascending.
When you run this method, the sort is applied to the table, form, report, or datasheet (for example, query result) that is active and has the focus.
However I am not finding success. Here what I have
The setFocus line creates error 2449 There is an invalid method in an expression.
If I rem this out (and the instructions says the Form needs the focus) the DoCmd line
shows Error 2046 The command or action 'SetOrderBy' isn't available now.
What is tne correct syntax to order by the WeeksOn column ?
You can also set the OrderByOn property for either forms or reports by using VBA.
The following code example sorts the active datasheet, form, report, or table by LastName descending and FirstName ascending.
Code:
DoCmd.SetOrderBy "LastName DESC, FirstName ASC"
However I am not finding success. Here what I have
Code:
[Form_zqryShow subform].RecordSource = "tblCombined"
[Form_zqryShow subform].SetFocus
DoCmd.SetOrderBy "WeeksOn ASC"
[Form_zqryShow subform].Refresh
If I rem this out (and the instructions says the Form needs the focus) the DoCmd line
shows Error 2046 The command or action 'SetOrderBy' isn't available now.
What is tne correct syntax to order by the WeeksOn column ?