ACC1x: How to Modify Toolbars

ID: Q88907


The information in this article applies to:


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



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 
Issue type        : kbhowto 

Last Reviewed: March 10, 1999