Echo Action

Microsoft Access Visual Basic

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 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 Microsoft 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, Microsoft Access automatically turns echo back on and repaints the window. The No setting for the Echo On argument doesn't affect 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 these to gather or display information even if echo is turned off. To turn off 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" in Microsoft Windows 2000 or Microsoft Windows XP) to provide a visual indication that the macro is running.

To run the Echo action in Visual Basic, use the Echo method of the DoCmd object.

Examples

Show 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. Then the GoToControl action 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 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.

Show Synchronize forms by using a macro

The following macro opens a 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.