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 uses the following arguments.

Action argument

Description

Message

The text in the message box. You can type up to 256 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 to sound the speaker once. Click No if you don’t want a beep. 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 bold heading “Solution”, which is provided for you.

Enter the following in the Message argument:

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

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.