UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Custom Error Handling, Office 2010    
 
   
crazybob62
post Mar 6 2012, 02:12 AM
Post #1

UtterAccess Member
Posts: 23



Hello

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
End Sub



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!
Go to the top of the page
 
+

Posts in this topic


Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 01:41 AM