ACC1x: How to Modify Toolbars
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:
- Quit Microsoft Access if you have it open and make sure that no
instances of Microsoft Access are active.
- 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
- 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:
- Open the form called FDTB in Design view. This is the toolbar that
appears when you bring up a form in Design view.
- 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.
- Set the button's OnPush property as follows:
=ToggleToolBox()
- Save and close the form.
- 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
- Save and close the module, and then close the database.
- Quit Microsoft Access.
- From Program Manager, open Notepad.
- In NotePad, open the MSACCESS.INI file from your Windows program
directory.
- In the MSACCESS.INI file, locate the [Options] section and modify the
UtilityDB= line to read:
UtilityDB=C:\ACCESS\UTILITY.NEW
- Save and close the MSACCESS.INI file, and then start Microsoft Access.
- 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
|