PRB: Run Macro Command Not Available on Startup Menu (2.0)

    Article ID: Q127057
    Creation Date: 09-MAR-1995
    Revision Date: 05-FEB-1996

    The information in this article applies to:

    • Microsoft Access Developer's Toolkit version 2.0

    SYMPTOMS

    Moderate: Requires basic macro, coding, and interoperability skills.

    When you run a macro or an Access Basic routine that uses a DoMenuItem action to choose the Run Macro command from the startup menu, you may receive the error message "Command not available."

    CAUSE

    The Run Macro command is not available on the startup menu.

    RESOLUTION

    Instead of using the DoMenuItem action to run a macro, use the RunMacro action. You can use the RunMacro action in macros and in Access Basic code. The syntax for the RunMacro action is

       DoCmd RunMacro "<macroname>"
    
    
    where <macroname> is the name of the macro you want to run.

    STATUS

    This behavior is by design.

    MORE INFORMATION

    In run-time applications developed with the Microsoft Access Developer's Toolkit, the startup menu is available only if all the open forms are hidden. As a general rule, an application's users should not be allowed to access this menu manually. Also, you should try to avoid using macros in applications designed to run in the run-time environment unless they are absolutely necessary (for example, for menus, custom toolbars, AutoExec macros, and so on). A macro's lack of error handling capabilities may lead to an abrupt or awkward termination of the application.

    Steps to Reproduce Behavior

    1. Open the sample database NWIND.MDB.
    2. Create the following new macro:

            Macro Name   Action
            -----------------------
            ^{F8}        DoMenuItem
      

            ^{F8} Actions
            ---------------------
            DoMenuItem
               Menu Bar: Startup
               Menu Name: File
               Command: Run Macro
      
    3. Save the macro as Autokeys.
    4. Close the database.
    5. Reopen NWIND.MDB.
    6. From the Window menu, choose Hide.
    7. Press CTRL+F8. Note that you receive the error message "Command not available."

    REFERENCES

    For more information about the RunMacro action, search for "RunMacro," and then "RunMacro Action" using the Microsoft Access Help menu.

    For more information about the DoMenuItem action, search for "DoMenuItem," and then "DoMenuItem Action" using the Microsoft Access Help menu.


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

Additional reference words: 2.00
KBCategory: kbusage kberrmsg
KBSubcategory: McrProb