Replace Access message

le888

Registered User.
Local time
Today, 16:11
Joined
Dec 10, 2003
Messages
344
Hi,

I have try :
Code:
   If (DoCmd.OutputTo acReport)= vbCancel Then
        MsgBox "Cancel",vbOkOnly
    Else
        
   End If
And it don't work. I want to replace the interne message that Access gives when the action is cancel. Is it possible?

Thanks,

Le
 
Hello

You need to use the SetWarnings statement to do this:

Regards
Mark

You can use this action to prevent modal warnings and message boxes from stopping the macro. However, error messages are always displayed. Also, Microsoft Access displays any dialog boxes that require input other than just choosing a button (such as OK, Cancel, Yes, or No)— for example, any dialog box that requires you to enter text or select one of several options.

Carrying out this action with the Warnings On argument set to No has the same effect as pressing ENTER whenever a warning or message box is displayed. Typically, an OK or Yes button is chosen in response to the warning or message.

When the macro finishes, Access automatically turns the display of system messages back on.

Often, you'll use this action with the Echo action, which hides the results of a macro until it's finished. You can use the SetWarnings action to hide the warnings and message boxes as well.

Caution Although the SetWarnings action can simplify interactions with macros, you must be careful about turning system messages off. In some situations, you won't want to continue a macro if a certain warning message is displayed. Unless you're confident of the outcome of all macro actions, you should avoid using this action.

To run the SetWarnings action in Visual Basic, use the SetWarnings method of the DoCmd object.
 

Users who are viewing this thread

Back
Top Bottom