This is some code from a DB I have written. Sorry if the code is a bit messy but this will work.
The code below applies to two buttons on top of each other. doorrefass and doorrefdesc.
Doorrefass is initially visible and when press sorts the column I place in the code. In this case Door_Refs. Once pressed the Doorrefdesc becomes visible.
Hope this helps you out.
EDIT: I forgot to mention that this applies to a continuous form.
Paul
'Sort functions - Doors Refs
Private Sub doorrefass_Click()
On Error GoTo doorrefass_Click_Err
DoCmd.Echo False, "Sorting records ..."
Screen.ActiveForm.AllowAdditions = False
DoCmd.GoToControl "Door_Refs"
DoCmd.RunCommand acCmdSortAscending
Me![doorrefdesc].Visible = True
Me![doorrefdesc].SetFocus
Me![doorrefass].Visible = False
DoCmd.Echo True, ""
Exit Sub
doorrefass_Click_Exit:
DoCmd.GoToRecord , , acFirst
Exit Sub
doorrefass_Click_Err:
Resume doorrefass_Click_Exit
End Sub
----------------------------------------------------------------
Private Sub doorrefDesc_Click()
On Error GoTo doorrefDesc_Click_Err
DoCmd.Echo False, "Sorting records ..."
Screen.ActiveForm.AllowAdditions = False
DoCmd.GoToControl "Door_Refs"
DoCmd.RunCommand acCmdSortDescending
Me![doorrefass].Visible = True
Me![doorrefass].SetFocus
Me![doorrefdesc].Visible = False
DoCmd.Echo True, ""
Exit Sub
doorrefDesc_Click_Exit:
DoCmd.GoToRecord , , acFirst
Exit Sub
doorrefDesc_Click_Err:
Resume doorrefDesc_Click_Exit
End Sub