In the following example I open the companies table and then sort by the service control, followed by another control.
Sub Docmd1()
DoCmd.OpenTable "Companies"
DoCmd.GoToControl "Service"
DoCmd.RunCommand acCmdSortDescending
DoCmd.GoToControl "DateEntered"
DoCmd.RunCommand acCmdSortAscending
End Sub
For the me.orderby
Create agrouped option group control and place as many options as necesssary. Give the value 1 2 3 etc
then type equivalent to the following code in the after update event
Private Sub grpSortBy_AfterUpdate()
'code to change the order of the records based on the
'selection in the option group grpSortBy
Select Case grpSortBy.Value
Case 1
'code to order by the CompanyName field
Me.OrderBy = "CompanyName"
Case 2
'code to order by the ContactName field
Me.OrderBy = "ContactName"
Case 3
'code to order by the City and CompanyName fields
Me.OrderBy = "City, CompanyName"
Case 4
'code to order by the Country, City and CompanyName fields
Me.OrderBy = "Country, City, CompanyName"
Case 5
'code to order by the Country, City and CompanyName fields
Me.OrderBy = "phone"
End Select
Regards
Jason