G
Guest
I have a form frmManageClients based on a query qryManageClients. I also have
a subform sfrmARLedger based on a query filter_sfrmARLedger_All. I have
linked the form to the subform with Link Child Fields prClient and Link
Master Fields dqClient. I have an option group on the main form to filter
records in the main form and another option group on the main form to filter
records in the subform. All works fine to this point. Then I added command
buttons to the main form to sort records the records displayed in the subform
based on multiple fields using the following code example:
strSQLSort = "prProject, [Invoice Date], [Invoice Number]"
Me!sfrmARLedger.Form.OrderBy = strSQLSort
DoCmd.RunCommand acCmdSave
Me!sfrmARLedger.Requery
The result is that the sort works sometimes and sometimes not at all (it
seems to depend on if I have opened the form and entered an OrderBy property
manually - but I could be mistaken). And if the sort does work, it only works
until I try to scroll through the records in the subform. As soon as I select
the subform, the sort goes back to whatever it was when the main form was
opened.
Any help would be appreciated. Thanks in advance.
a subform sfrmARLedger based on a query filter_sfrmARLedger_All. I have
linked the form to the subform with Link Child Fields prClient and Link
Master Fields dqClient. I have an option group on the main form to filter
records in the main form and another option group on the main form to filter
records in the subform. All works fine to this point. Then I added command
buttons to the main form to sort records the records displayed in the subform
based on multiple fields using the following code example:
strSQLSort = "prProject, [Invoice Date], [Invoice Number]"
Me!sfrmARLedger.Form.OrderBy = strSQLSort
DoCmd.RunCommand acCmdSave
Me!sfrmARLedger.Requery
The result is that the sort works sometimes and sometimes not at all (it
seems to depend on if I have opened the form and entered an OrderBy property
manually - but I could be mistaken). And if the sort does work, it only works
until I try to scroll through the records in the subform. As soon as I select
the subform, the sort goes back to whatever it was when the main form was
opened.
Any help would be appreciated. Thanks in advance.