Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: ShowToolbar with Where Appropriate Hides Custom Toolbar


View products that this article applies to.

This article was previously published under Q198445
Moderate: Requires basic macro, coding, and interoperability skills.

↑ Back to the top


Symptoms

If a macro contains the ShowToolbar action with the Toolbar Name argument set to the name of a custom toolbar, and if that toolbar is already visible, running the macro hides the toolbar instead of showing it. This behavior also occurs when you run a Visual Basic for Applications procedure that contains the ShowToolbar method with the toolbarname argument set to the name of a custom toolbar.

↑ Back to the top


Cause

You have set the Show argument of the ShowToolbar action to Where Appropriate in your macro, or you are using the constant, acToolbarWhereApprop, with the ShowToolbar method in your Visual Basic for Applications procedure.

↑ Back to the top


Resolution

To work around this behavior, use either of the following methods.

Method 1

Set the Show argument of the ShowToolbar macro action to Yes.

-or-

Use the constant, acToolbarYes, with the ShowToolbar method in your Visual Basic for Applications procedure.

Method 2

If you want to set the Show argument of the ShowToolbar macro action to Where Appropriate, or if you want to use the constant, acToolbarWhereApprop, with your Visual Basic for Applications procedure, attach the custom toolbar to a form or report. To do so, follow these steps:
  1. In the Database window, select the form or report to which you want to attach the custom toolbar, and then click Design.
  2. On the Edit menu, click either Select Form or Select Report.
  3. On the View menu, click Properties, and in the Form dialog box, click the Other tab.
  4. Click in the Toolbar box and select the custom toolbar.
The custom toolbar appears when you open the form or report. If you hide the toolbar and then run the macro or procedure, the toolbar reappears. If the toolbar is still visible and you run the macro or procedure, the toolbar is visible when you set the focus back to the form or report to which it is attached.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.
  2. On the View menu, point to Toolbars, and then click Customize.
  3. Click the Toolbars tab, and then click New.
  4. In the New Toolbar dialog box, type Custom1 in the Toolbar Name box, and then click OK.
  5. In the Customize dialog box, click Close.
  6. Under Objects click the Macros, and then click New.
  7. Create the following new macro:
       Action
       -----------
       ShowToolbar
    
       Action Arguments
       -------------------------------
       Toolbar Name: Custom1
               Show: Where Appropriate
    					
  8. Save the macro as macShowBar and run it. Note that the custom toolbar is now hidden.

↑ Back to the top


References

For more information about ShowToolbar, click Microsoft Access Help on the Help menu, type ShowToolbar Action in the Office Assistant or the Answer Wizard, and then click Search to view the topic. To display the ShowToolbar Method, click See also, and then click ShowToolbar Method.

↑ Back to the top


Keywords: KB198445, kbbug

↑ Back to the top

Article Info
Article ID : 198445
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 545