MsgBox Action

Description

You can use the MsgBox action to display a message box containing a warning or an informational message. For example, you can use the MsgBox action with validation macros. When a control or record fails a validation condition in the macro, a message box can display an error message and provide instructions about the kind of data that should be entered.

Setting

The MsgBox action has the following arguments.

Action argument

Description

Message

The text in the message box. Enter the message text in the Message box in the Action Arguments section of the Macro window. You can type up to 255 characters or enter an expression (preceded by an equal sign).

Beep

Specifies whether your computer's speaker sounds a beep tone once when the message displays. Click Yes (sound the beep tone) or No (don't sound the beep tone). The default is Yes.

Type

The type of message box. Each type has a different icon. Click None, Critical, Warning?, Warning!, or Information. The default is None.

Title

The text displayed in the message box title bar. For example, you can have the title bar display "Customer ID Validation". If you leave this argument blank, "Microsoft Access" is displayed.


Remarks   You can use the MsgBox action to create a formatted error message similar to built-in error messages displayed by Microsoft Access. The MsgBox action permits you to supply a message in three sections for the Message argument. You separate the sections with the "@" character.

The following example displays a formatted message box with a sectioned message. The first section of text in the message is displayed as a bold heading. The second section is displayed as plain text beneath that heading. The third section is displayed as plain text beneath the second section, with a blank line between them.

Enter the following in the Message argument:

Wrong button!@This button doesn't work.@Try another.

Note If the Office Assistant is visible, the message is displayed in the Assistant's balloon instead of in a separate message box.

Microsoft Windows 95 and Windows NT display slightly different icons for the Type argument settings.

You can't run the MsgBox action in Visual Basic. Use the MsgBox function instead.

See Also   CancelEvent action, ValidationRule, ValidationText properties.