I have a continuous form that I'm using with various filters. There is a command button to filter the form based on what the user selects in a few combo boxes. The "Apply Filter" command button is the default so when the user presses "Enter" on the keyboard, the form gets filtered. There is also a "Cancel filter - show all records" button.
If the user starts to enter data in the filter boxes but presses "Esc" before applying the filter, then the form undoes the entries and resets to unfiltered. That's fine. But if the user presses the "Esc" button after the form is filtered (either by pressing "Enter" or pressing the "Apply Filter" button, then Access produces a run-time error 2001 (You canceled the previous operation).
How can I trap this error for Access to disregard it or to mimic the "Cancel Filter" button if the user presses "Esc".
If the user starts to enter data in the filter boxes but presses "Esc" before applying the filter, then the form undoes the entries and resets to unfiltered. That's fine. But if the user presses the "Esc" button after the form is filtered (either by pressing "Enter" or pressing the "Apply Filter" button, then Access produces a run-time error 2001 (You canceled the previous operation).
How can I trap this error for Access to disregard it or to mimic the "Cancel Filter" button if the user presses "Esc".