Good Morning,
I have a form with a subform. In the subform, I'm putting a button in the header that allows the user to toggle between sort ascending and descending. The button works perfectly on the first click but will not allow access to do anything else. If you click another button (any button) you get the message "error 2486 -- you can't carry out this action at the present time".
Any ideas of why I'm getting this error or how to sort on a subform? I guess I could build a procedure that rebuilds the data source and ORDER BY based on which button is clicked but I thought this would be easier.
Thanks,
Rewdee
I have a form with a subform. In the subform, I'm putting a button in the header that allows the user to toggle between sort ascending and descending. The button works perfectly on the first click but will not allow access to do anything else. If you click another button (any button) you get the message "error 2486 -- you can't carry out this action at the present time".
Code:
==========================================================
Private Sub CmdSortEvent_Click()
If Me.CmdSortEvent.Caption = "Events (a-z)" Then
DoSort "txtevent_ID", acCmdSortAscending
Me.CmdSortEvent.Caption = "Events (z-a)"
Else
DoSort "txtevent_ID", acCmdSortDescending
Me.CmdSortEvent.Caption = "Events (a-z)"
End If
End Sub
Private Sub DoSort(sCtrlName As String, lngSortMethod)
'generic procedure to do sort on a current recordset
DoCmd.Hourglass True
Screen.ActiveForm.AllowAdditions = False
DoCmd.GoToControl sCtrlName
DoCmd.RunCommand lngSortMethod
DoCmd.Hourglass False
End Sub
==========================================================
Thanks,
Rewdee