ACC1x: How to Modify Toolbars

Last reviewed: July 22, 1997
Article ID: Q88907
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1

SUMMARY

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

Although Microsoft Access does not include any end-user features for modifying the toolbar at the top of the screen, you can modify the toolbar if you know how to design a form and write Access Basic code. This article discusses where toolbars are stored, how they work, and how you can modify them.

Notes

  • Modification of the toolbar was not intentionally designed into Microsoft Access, so you may run into situations where your modifications do not work. Test your modifications on noncritical databases because making these modifications is not guaranteed to work correctly in every instance. Modifications to toolbars are not supported by Microsoft.
  • This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Access Basic, please refer to the "Introduction to Programming" manual.

MORE INFORMATION

The various toolbars that appear when you are using Microsoft Access are nothing more than forms stored in a database--the same kind of forms that you create in Microsoft Access. These forms are stored in the UTILITY.MDA file, a system database file that is loaded into memory when you start Microsoft Access.

You cannot simply start Microsoft Access and open the UTILITY.MDA file to modify these forms, however. This is because the UTILITY.MDA file is loaded as a library database when you are using Microsoft Access and you are not allowed to open a library database while it is active. To work around this, do the following:

  1. Quit Microsoft Access if you have it open and make sure that no instances of Microsoft Access are active.

  2. Choose the MS-DOS Prompt icon in Program Manager and type the following commands at the MS-DOS command prompt (the example below assumes that your Microsoft Access system files are stored in a directory called C:\ACCESS). Press ENTER after each command:

         CD \ACCESS
         COPY UTILITY.MDA UTILITY.NEW
    

  3. Start Microsoft Access.

At this point, you can begin modifying the toolbars in the UTILITY.NEW file.

Open the UTILITY.NEW file as a database (a couple of alerts will appear about loading duplicate procedure names; ignore these alerts by choosing the OK button). In the Database window, switch to Form view and note the names of the forms. The forms in the Database window that end with the characters "TB" are toolbar forms. At this point, you can open a toolbar form and make a modification. After you have made the modification, you can change a setting in your MSACCESS.INI file that will force Microsoft Access to use the UTILITY.NEW file instead of the UTILITY.MDA file as its utility database.

It is important to note that any functionality you add to new controls on the toolbars must be supported by Access Basic--do not use macros, because they will not work for this purpose.

The example below illustrates how you can add a toolbar button to your form design toolbar that will toggle the toolbox on and off:

  1. Open the form called FDTB in Design view. This is the toolbar that appears when you bring up a form in Design view.

  2. Add a small command button to the right of the Paint Palette toolbar button on the form. Make sure your button does not overlap any other controls and that it does not alter the height of the form.

  3. Set the button's OnPush property as follows:

    =ToggleToolBox()

  4. Save and close the form.

  5. Create a new module called NewToolBarFunctions and add the following sample function:

    Function ToggleToolBox ()

              DoCmd DoMenuItem 3, 2, 8
              ' The DoCmd command above invokes the forms design menu item
              ' View->Toolbox.
          End Function
    
    

  6. Save and close the module, and then close the database.

  7. Quit Microsoft Access.

  8. From Program Manager, open Notepad.

  9. In NotePad, open the MSACCESS.INI file from your Windows program directory.

  10. In the MSACCESS.INI file, locate the [Options] section and modify the UtilityDB= line to read:

    UtilityDB=C:\ACCESS\UTILITY.NEW

  11. Save and close the MSACCESS.INI file, and then start Microsoft Access.

  12. Open any database, and open any form in Design view. Note that the button you added appears in the toolbar. Click the button to turn the toolbox on and off.

In the same way you modified your form design toolbar using the steps above, you can make other modifications to add functionality to the other Microsoft Access toolbars.


Additional query words: customize update
Keywords : kbprg kbui MdlLib UifToolb
Version : 1.0 1.1
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto


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