Echo Macro Action

You can use the Echo macro action to specify whether echo is turned on in Access desktop databases. For example, you can use this action to hide or show the results of a macro while it runs.

Note: This action will not be allowed if the database is not trusted.

Note: The Echo macro action isn't available in Access web apps.

Setting

The Echo macro action has the following arguments.

Action argument

Description

Echo On

Click Yes (turn echo on) or No (turn echo off) in the Echo On box in the Action Arguments section of the Macro Builder window. The default is Yes.

Status Bar Text

The text to display in the status bar when echo is turned off. For example, when echo is turned off, the status bar can display "The macro is running."

Remarks

When Access runs a macro, screen updating often shows information not essential to the functioning of the macro. When you set the Echo On argument to No, the macro runs without updating the screen. When the macro finishes, Access automatically turns echo back on and repaints the window. The No setting for the Echo On argument doesn't affect the functionality of the macro or its results.

The Echo action doesn't suppress the display of modal dialog boxes, such as error messages, or pop-up forms, such as property sheets. You can use dialog boxes and pop-up forms to gather or display information, even if echo is turned off. To suppress all message or dialog boxes except error message boxes and dialog boxes that require the user to enter information, use the SetWarnings action.

You can run the Echo action more than once in a macro. This allows you to change the status bar text while the macro runs.

If you turn echo off, you can use the Hourglass action to change the mouse pointer into an hourglass icon (or whatever mouse pointer icon you've set for "Busy") to provide a visual indication that the macro is running.

To run the Echo action in a Visual Basic for Applications (VBA) module, use the Echo method of the DoCmd object.

Examples

Set the value of a control by using a macro

The following macro opens the Add Products form from a button on the Suppliers form. It shows the use of the Echo, Close, OpenForm, SetValue, and GoToControl actions. The SetValue action sets the Supplier ID control on the Products form to the current supplier on the Suppliers form. The GoToControl action then moves the focus to the Category ID field, where you can begin to enter data for the new product. This macro should be attached to the Add Products button on the Suppliers form.

Action

Arguments: Setting

Comment

Echo

Echo On: No

Stop screen updating while the macro is running.

Close

Object Type: Form

Object Name: Product List

Save: No

Close the Product List form.

OpenForm

Form Name: Products

View: Form

Data Mode: Add

Window Mode: Normal

Open the Products form.

SetValue

Item: [Forms]![Products]![SupplierID]

Expression: SupplierID

Set the Supplier ID control to the current supplier on the Suppliers form.

GoToControl

Control Name: CategoryID

Go to the Category ID control.

Synchronize forms by using a macro

The following macro opens the Product List form in the lower-right corner of the Suppliers form, displaying the current supplier's products. It shows the use of the Echo, MsgBox, GoToControl, StopMacro, OpenForm, and MoveSize actions. It also shows the use of a conditional expression with the MsgBox, GoToControl, and StopMacro actions. This macro should be attached to the Review Products button on the Suppliers form.

Condition

Action

Arguments: Setting

Comment

Echo

Echo On: No

Stop screen updating while the macro is running.

IsNull([Supplier ID])

MsgBox

Message: Move to the supplier record whose products you want to see, then click the Review Products button again.

Beep: Yes

Type: None

Title: Select a Supplier

If there is no current supplier on the Suppliers form, display a message.

...

GoToControl

Control Name: CompanyName

Move focus to the CompanyName control.

...

StopMacro

Stop the macro.

OpenForm

Form Name: Product List

View: Datasheet

Filter Name:

Where Condition: [Supplier ID] = [Forms]![Suppliers]![SupplierID]

Data Mode: Read Only

Window Mode: Normal

Open the Product List form and show the current supplier's products.

MoveSize

Right: 0.7799"

Down: 1.8"

Position the Product List form in the lower right of the Suppliers form.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×