I have a very simple database that has a few tables for keeping a few student course records. I have a VBA macro with the following data which simply opens a report in preview mode when the user clicks on the command button:
Private Sub cmdCompleteActiveTraining_Click()
DoCmd.OpenReport "rptTrainingAllActiveCompleteDateRange", acViewPreview, , , acWindowNormal
The report is based on a query so when the user clicks the button, a couple of popup boxes appear one at a time asking for a date range. The results will display on a printable report. Here is my issue: If the user executes the command button and the pop-up boxes appear, if during this time the user hits the "Esc" key to cancel the execution, I get the Error Box: Run Time Error 2501 The OpenReport Action was cancelled. Then it asks to Continue/Debug/Cancel/Help.
What I want is a custom message, something like "Task Cancelled by User" then an OK button so the user could return to the menu screen where they were prior to executing the command button. Or if this is too tedious, when the person hits "Esc", it simply takes them back to the previous form screen.
Any help is appreciated!