SetWarnings Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

The SetWarnings method carries out the SetWarnings action in Visual Basic.

expression.SetWarnings(WarningsOn)

expression   Required. An expression that returns one of the objects in the Applies To list.

WarningsOn  Required Variant. Use True (–1) to turn on the display of system messages and False (0) to turn it off.

Remarks

For more information on how the action and its argument work, see the action topic.

If you turn the display of system messages off in Visual Basic, you must turn it back on, or it will remain off, even if the user presses CTRL+BREAK or Visual Basic encounters a breakpoint. You may want to create a macro that turns the display of system messages on and then assign that macro to a key combination or a custom menu command. You could then use the key combination or menu command to turn the display of system messages on if it has been turned off in Visual Basic.

Example

The following example turns the display of system messages off:

  DoCmd.SetWarnings False