Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Updates: (c) Microsoft
Office downloads
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Creating a MyFavorites menu for database objects in Access
 
Applies to
Microsoft Office Access 2003
Microsoft Access 2002

Tired of hunting around the Access Database window to open that favorite database object? Wouldn't it be handy to create a MyFavorites menu, much like the Web toolbar Favorites menu, for quick links to database objects and other objects?

Custom menu on standard Access menu bar

Here's how to do it.

First, open the sample Northwind database or Access project.
  1. On the Help menu, point to Sample Databases, and then click the database you want to open.

    Note  This procedure works the same for Access databases or Access projects.

  2. If the database isn't currently installed, click Yes to install it now.

    Note   If you don't see a list of databases when you point to Sample Databases, you can install them by double-clicking Add/Remove Programs in Windows Control Panel and running Microsoft Office Setup.

  3. In Access 2003, you might see a security warning. Click Open to open the file.
Next, create a custom menu bar.
  1. On the View menu, point to Toolbars, and then click Toolbars.
  2. In the Customize dialog box, click the Toolbars tab, and then click New.
  3. In the Toolbar name box, type NorthwindCustomMenuBar, and then click OK. Access displays a small, blank, custom menu bar.
  4. Click the Commands tab, and then in the Categories list, click Built-in Menus.
  5. From the Commands list, drag the following built-in menus onto the small, blank, custom menu bar, in this order: File, Edit, View, Insert, Tools, Window, and Help.
  6. Click the Toolbars tab, click Properties, and then in the Type list, select Menu Bar. Then click Close.
  7. Close the Customize dialog box.
Then, make NorthwindCustomMenuBar the new default menu bar for Northwind.
  1. On the Tools menu, click Startup, and then in the Menu Bar list, select NorthwindCustomMenuBar.
  2. To make your changes take effect, close the database or project and then reopen it.
Then, add the menu and submenu commands to the main menu bar.
  1. On the View menu, point to Toolbars, and then click Toolbars.

    Note   Keep the Customize dialog box open for all remaining steps.

  2. In the Customize dialog box, click the Commands tab.
  3. In the Categories list, scroll to the bottom and then click New Menu.
  4. From the Commands list, drag New Menu between Tools and Window on the menu bar.
  5. Right-click New Menu on the menu bar, and in the Name box, type &MyFavorites.

    Note   Including the ampersand character (&) adds a shortcut key to each submenu command.

  6. From the Commands list, drag New Menu over the MyFavorites menu until the top-level menu drops down, and then add New Menu underneath MyFavorites. Add this submenu three times.
  7. Right-click each new menu, and rename them as follows:

    &Tables and Queries
    &Forms, Reports, and Pages
    &Other Commands
Then, add commands to the submenus.
  1. In the Categories list, click All Tables.
  2. From the Commands list, drag Customers over the MyFavorites menu until the top-level menu drops down; then drag it over Tables and Queries until the submenu opens; then release the mouse to add Customers to the submenu.
  3. Right-click the Customers command, type the ampersand character (&) before the letter "C," and then press ENTER.
  4. Repeat steps 2 and 3 for each additional submenu by adding the commands and shortcut keys from the following table.
    Submenu Categories Commands
    Tables and Queries All Tables &Customers
    Tables and Queries All Tables &Products
    Tables and Queries All Queries (Database)
    All Stored Procedures (Project)
    &Ten Most Expensive Products
    Tables and Queries All Queries (Database)
    All Views (Project)
    Products &Above Average Price
    Forms, Reports, and Pages All Forms &Employees
    Forms, Reports, and Pages All Forms Customer &Phone List
    Forms, Reports, and Pages All Reports Customer &Labels
    Forms, Reports, and Pages All Reports &Alphabetical List of Products
    Forms, Reports, and Pages All Web Pages Analyze &Sales

    Note  In the English language version of Access 2002, NorthwindCS.adp does not contain sample data access pages when first installed, but you can import them from Northwind.mdb. See Adding sample data access pages to NorthwindCS.adp in Access, on Office Online.

    Other Commands File Custom
    Other Commands File Custom
Tips  
  • To reorganize the submenu commands after adding them, just drag each command into a different position.
  • To group related commands in the submenu, add separator bars. Right-click a command, click Properties, and then select the Begin a Group check box.
Then, on the Other Commands menu, add a hyperlink to the Microsoft Developer Network (MSDN).
  1. Right-click the first Custom command and rename it &Office Developer.
  2. Right-click Office Developer, point to Change Button Image, and then click any image.
  3. Right-click Office Developer, point to Assign Hyperlink, and then click Open.
  4. In the Address box , type http://msdn.microsoft.com/office/.
Then, on the Other Commands menu, add a built-in function called "Good Day Mate!"
  1. Right-click the second Custom command and rename it &Good Day Mate!
  2. Right-click Good Day Mate!, point to Change Button Image, and then click any image.
  3. Right-click Good Day Mate!, click Properties, and then type the following expression in the On Action box:
    =MsgBox(IIf(Instr(Time(), "PM"), "Good Afternoon", "Good Morning") & "! It's " & Time())

Note   You can also add a custom function to a command. For example, if you have a custom function named SetCaption(), type =SetCaption() in the On Action box.

Finally, test your new menu.

Try each command on your new menu. Make sure each command opens the intended database object and performs the intended action. Test the shortcut keys by pressing ALT + each underlined letter. Add more objects and commands over time. After all, they're YourFavorites!

advertisement