I am trying to use the following code on a button to clear the Advanced/Filter/Sort Grid on a form.
I receive the following error. The command or action “ViewGrid” isn’t available now.
What is the solution to this problem?
Thank you in advance.
Private Sub cmdRemoveFilter_Click()
On Error GoTo Err_cmdRemoveFilter_Click
DoCmd.RunCommand acCmdViewGrid
DoCmd.RunCommand acCmdClearGrid
DoCmd.RunCommand acCmdApplyFilterSort
Exit_cmdRemoveFilter_Click:
Exit Sub
Err_cmdRemoveFilter_Click:
MsgBox Err.Description
Resume Exit_cmdRemoveFilter_Click
End Sub