ACC: Cannot Add Security Items to Custom Menu

Last reviewed: May 28, 1997
Article ID: Q103992
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SYMPTOMS

Advanced: Requires expert coding, interoperability, and multiuser skills.

If you add a security command to a custom menu with a DoMenuItem action, the security command will be unavailable.

CAUSE

You can only perform DoMenuItem actions with commands available from the current context. If you have a form open, you can only perform menu items available to a form. Since security items are available only from the Database window, they will not work when invoked from a form.

RESOLUTION

You can add the security command Change Password to a custom menu using the following sample macro:

   Macro Name         Action        Defined Below
   ----------------------------------------------
   Change Password    Echo               1
                      SelectObject       2
                      DoMenuItem         3
                      DoMenuItem         4
                      SelectObject       5

   Change Password Actions
   ---------------------------------------------------------
   1. Echo
         Echo On: No
   2. SelectObject
         Object Type: Form
         Object Name: <name of the form that the menu is on>
         In Database window: Yes
   3. DoMenuItem
         Menu Bar: Database
         Menu Name: Security
         Command: Change Password
   4. DoMenuItem
         Menu Bar: Database
         Menu Name: Window
         Command: Hide
   5. SelectObject
         Object Type: Form
         Object Name: <name of the form that the menu is on>
         In Database window: No

NOTE: Actions 1 and 5 are used if you need to have the Database window hidden while using the retail version of Microsoft Access. The Echo action in step 1 ensures that the Database window is not visible when it is activated in step 2. Step 4 hides the Database window again. If you are using the Microsoft Access Distribution Kit (ADK), steps 1 and 5 can be omitted since the Database window is always hidden.

The only side effect to this workaround is that when the Change Password dialog box appears, you will see the Database window menu items in the background. However, you will not be able to choose them.

STATUS

This behavior no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create the following macro and save it as Security Menu:

          Action      Defined Below
          -------------------------
          AddMenu          1
    
          Security Menu Actions
          ---------------------------------------------
          1. AddMenu
                Menu Name: Security Menu
                Menu Macro Name: Security Menu Password
                Status Bar Text: Change Password
    
    

  2. Create the following macro and save it as Security Menu Password:

          Macro Name        Action     Defined Below
          ------------------------------------------
          Change Password   DoMenuItem       1
    
          Security Menu Password Actions
          ------------------------------
          1. DoMenuItem
                Menu Bar: Database
                Menu Name: Security
                Command: Change Password
    
    

  3. Create a form and set the OnMenu property to Security Menu.

  4. View the form in Form view and note that Change Password is unavailable on the Security menu.


Keywords : kbusage McrOthr
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : kbfix


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 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.