home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / dbase / acessq_a.zip / Q88907.TXT < prev    next >
Text File  |  1992-11-01  |  4KB  |  114 lines

  1. How to Modify the Toolbar in Microsoft Access
  2.  
  3. Summary:
  4.  
  5. Although Microsoft Access does not include any end-user features for
  6. modifying the toolbar at the top of the screen, you can modify the
  7. toolbar if you know how to design a form and write Access Basic code.
  8. This article discusses where toolbars are stored, how they work, and
  9. how you can modify them.
  10.  
  11. NOTE: Modification of the toolbar was not intentionally designed into
  12. Microsoft Access, so you may run into situations where your
  13. modifications do not work. Test your modifications on noncritical
  14. databases, since making these modifications is not guaranteed to work
  15. correctly in every instance.
  16.  
  17. This article assumes that you have some experience with designing
  18. forms and writing procedures in Access Basic.
  19.  
  20. More Information:
  21.  
  22. The various toolbars that appear when you are using Microsoft Access
  23. are nothing more than forms stored in a database--the same kind of
  24. forms that you create in Microsoft Access. These forms are stored in
  25. UTILITY.MDA, a system database file that is loaded into memory when
  26. you start Microsoft Access.
  27.  
  28. You cannot simply start Microsoft Access and open UTILITY.MDA to
  29. modify these forms, however. This is because UTILITY.MDA is loaded as
  30. a library database when you are using Microsoft Access, and Microsoft
  31. Access does not allow you to open a library database while it is
  32. active. To work around this, do the following:
  33.  
  34. 1. Quit Microsoft Access if you have it open and make sure that no
  35.    instances of Microsoft Access are active.
  36.  
  37. 2. Choose the MS-DOS Prompt icon in Program Manager and type the
  38.    following commands at the MS-DOS command prompt (the example below
  39.    assumes that your Microsoft Access system files are stored in a
  40.    directory called C:\ACCESS):
  41.  
  42.       C:>CD \ACCESS
  43.       C:\ACCESS>COPY UTILITY.MDA UTILITY.NEW
  44.  
  45. 3. Start Microsoft Access.
  46.  
  47. At this point, you can begin modifying the toolbars in UTILITY.NEW.
  48.  
  49. Open UTILITY.NEW as a database (a couple alerts will appear about
  50. loading duplicate procedure names; ignore these alerts by choosing the
  51. OK button). In the Database window, switch to Form view and note the
  52. names of the forms. The forms in the Database window that end with the
  53. characters "TB" are toolbar forms. At this point, you can open a
  54. toolbar form and make a modification. After the modification is made,
  55. you can change a setting in your MSACCESS.INI file that will force
  56. Microsoft Access to use UTILITY.NEW instead of UTILITY.MDA as its
  57. utility database.
  58.  
  59. It is important to point out that any functionality you add to new
  60. controls on the toolbars must be supported by Access Basic--do not use
  61. macros, as they will not work for this purpose.
  62.  
  63. The example below illustrates how you can add a toolbar button to your
  64. form design toolbar that will toggle the toolbox on and off:
  65.  
  66.  1. Open the form called FDTB in design mode. This is the toolbar that
  67.     appears when you bring up a form in design mode as you are doing
  68.     at this point.
  69.  
  70.  2. Add a small command button next to right of the "paint palette"
  71.     toolbar button on the form. Make sure your button does not overlap
  72.     any other controls and that it does not alter the height of the
  73.     form.
  74.  
  75.  3. For the button's OnPush property, specify:
  76.  
  77.        =ToggleToolBox()
  78.  
  79.  4. Save and close the form.
  80.  
  81.  5. Create a new module called NewToolBarFunctions and add the
  82.     following function:
  83.  
  84.     Function ToggleToolBox ()
  85.         DoCmd DoMenuItem 3, 2, 8
  86.         ' The DoCmd command above invokes the forms design menu item
  87.         ' View->Toolbox
  88.     End Function
  89.  
  90.  6. Save and close the module and close the database.
  91.  
  92.  7. Quit Microsoft Access.
  93.  
  94.  8. From Program Manager, open Notepad.
  95.  
  96.  9. In NotePad, open the file MSACCESS.INI from your Windows program
  97.     directory.
  98.  
  99. 10. In MSACCESS.INI, locate the [Options] section and modify the
  100.     UtilityDB= line to read:
  101.  
  102.        UtilityDB=C:\ACCESS\UTILITY.NEW
  103.  
  104. 11. Save and close MSACCESS.INI and start Microsoft Access.
  105.  
  106. 12. Open any database, and open any form in design mode. Note that the
  107.     button you added appears in the toolbar. Click the button to turn
  108.     the toolbox on and off.
  109.  
  110. In the same way you modified your form design toolbar using the steps
  111. above, you can make other modifications to add functionality to your
  112. Microsoft Access toolbars.
  113.  
  114.