ShowToolbar Action

ShowToolbar Action

See Also        

You can use the ShowToolbar action to display or hide a built-in toolbar or a custom toolbar. You can display a built-in toolbar in all Microsoft Access windows or just the view in which the toolbar is normally displayed (for example, the Form View toolbar in Form view).

Note   The ShowToolbar action affects only toolbars, not menu bars or shortcut menus.

Setting

The ShowToolbar action has the following arguments.

Action argument Description
Toolbar Name The name of the toolbar you want to display or hide. The Toolbar Name box in the Action Arguments section of the Macro window shows all the built-in toolbars in Microsoft Access, followed by any custom toolbars you've defined in the current database. This is a required argument.
  If the Allow Built-in Toolbars check box in the Startup dialog box (available by clicking Startup on the Tools menu) is cleared, you can use this action only to display and hide custom toolbars.
  If you run a macro containing the ShowToolbar action in a library database, Microsoft Access looks for the toolbar with this name first in the library database, then in the current database.
Show Specifies whether to display or hide the toolbar and in which views to display or hide it. The default is No (hide the toolbar).
  For built-in toolbars, you can select Yes to display the toolbar in all Microsoft Access windows that become active, Where Appropriate to display the toolbar only in the view it's normally displayed in (as Microsoft Access does by default), or No to hide the toolbar in all Microsoft Access windows.
  For custom toolbars, you can select Yes to display a form or report's custom toolbar in all Microsoft Access windows when the form or report becomes active,Where Appropriate to display a form or report's custom toolbar for the active window displaying the active form or report, or No to hide the toolbar in all Microsoft Access windows.

Remarks

You can use this action in a macro with conditional expressions to display or hide one or more toolbars depending on certain conditions.

If you want to show a particular toolbar on just one form or report, you can set the OnActivate property of the form or report to the name of a macro that contains a ShowToolbar action to show the toolbar. Then set the OnDeactivate property of the form or report to the name of a macro that contains a ShowToolbar action to hide the toolbar.

The ShowToolbar action has the same effect as pointing to Toolbars on the View menu and clicking Customize, then selecting or clearing a specific toolbar on the Toolbars tab of the Customize dialog box. The ShowToolbar action enables you to specify whether a built-in toolbar is displayed in all Microsoft Access windows or just the view in which it's normally displayed.

The built-in toolbars are also not available to display or hide by using this action if you set the AllowBuiltInToolbars property to False (0) in Visual Basic, or if you set the Allow Built-in Toolbars option to False in Visual Basic by using the SetOption method.

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