ACC95: Run Macro Command Not Available on Startup Menu

Last reviewed: May 12, 1997
Article ID: Q138772
The information in this article applies to:
  • Microsoft Access version 7.0

SYMPTOMS

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

When you run a macro or Visual Basic for Applications routine that uses a DoMenuItem action to choose the Macro command from the Startup menu, you may receive the following error message:

   The command or action 'Macro' isn't available now"

CAUSE

The 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 Visual Basic code. The syntax for the RunMacro action is as follows

   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 gain access to 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 Northwind.mdb.

  2. Create the following new macro:

          Macro Name   Action
          -----------------------
          ^{F8}        DoMenuItem
    
          ^{F8} Actions
          --------------------
          DoMenuItem
             MenuBar: Startup
             MenuName: Tools
             Command: Macro
    
    

  3. Save the macro and name it Autokeys.

  4. Close the database.

  5. Reopen Northwind.mdb.

  6. On the Window menu, click Hide.

  7. Press CTRL+F8. Note that you receive the error message, "The command or action 'Macro' isn't available now."

REFERENCES

For more information about the RunMacro action, search for "RunMacro Action," using the Microsoft Access for Windows 95 Help Index.

For more information about the DoMenuItem action, search for "DoMenuItem Action," using the Microsoft Access for Windows 95 Help Index.


Keywords : kberrmsg kbusage McrProb
Version : 7.0
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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.

Last reviewed: May 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.