SetWarnings Macro Action

You can use the SetWarnings action to turn system messages on or off.

Note   This action will not be allowed if the database is not trusted. For more information about enabling macros, see the links in the See Also section of this article.


The SetWarnings action has the following argument.

Action argument


Warnings On

Specifies whether system messages are displayed. Click Yes (to turn on system messages) or No (to turn off system messages) in the Warnings On box in the Action Arguments section of the Macro Builder Pane. The default is No.


You can use this action to prevent modal warnings and message boxes from stopping the macro. However, error messages are always displayed. Also, Microsoft Office Access 2007 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.

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 a Visual Basic for Applications (VBA) module, use the SetWarnings method of the DoCmd object.

Applies To: Access 2007, Access 2010 Developer, Access 2013 Developer, Access 2007 Developer, Access 2013, Access 2016, Access 2010

Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Change language