Introduction - Access 2003.
We were formally introduced to Custom Toolbars, Submenus, and Shortcut Menus in earlier posts, Animated Floating Calendar, and 'Calendar and Toolbars'. There, we also explored how to reference individual buttons to enable or disable them depending on the specific context or requirements.
In this post, we’ll take a closer look at Custom Menu Bars, Toolbars, and Shortcut Menus. Since this is a broad topic, we’ll be covering it across two or three separate posts.
MENU BARS.
Windows-based applications typically feature a menu bar at the top with titles like File, Edit, View, Insert, and so on. Clicking on any of these reveals a drop-down list of options—some with only descriptive text, others with icons and text. Selecting an item from the list triggers a specific action, helping you complete your task.
Similarly, in Microsoft Access, we can design custom menu bars tailored to our application, with menu titles like Data Files (to open forms linked to tables or queries), Reports (to preview or print reports), Utilities (for common tasks), and more. Menu items can be added under each heading and linked to corresponding actions.
For now, we’ll focus on designing the menu bar itself. Once you understand that process, creating toolbars and shortcut menus becomes much easier, as the approach is largely the same—you’ll just need a bit of guidance.
Customizing Toolbars.
From the View menu, go to Toolbars and select the Customize command.
On the Toolbars tab, click New.
In the Toolbar Name field, type
MyMenuBar
then click the Ok Button. The new toolbar name will appear in the toolbars list, and a small empty toolbar will be displayed somewhere on the application surface, not necessarily at the top.
At this point, you might wonder: We’re talking about Menu Bars, so why are we creating a Toolbar? In Microsoft Access, every custom menu bar or shortcut menu begins as a toolbar. Once created, you can redefine it as a Menu Bar or as a Popup Menu (i.e., Shortcut Menu). Simply naming a toolbar won't change its category—it must be explicitly defined. Also, make sure the new name doesn’t conflict with any built-in menus when referencing it in code.
Now, let’s convert our MyMenuBar
toolbar into a real menu bar:
-
In the Customize dialog box, click on
MyMenuBar
in the toolbars list (if it’s not already selected). -
Click the Properties button.
-
In the Properties window, you’ll see
MyMenuBar
under Selected Toolbar and Toolbar Name. -
In the Type dropdown list, select Menu Bar from the available options (Menu Bar, Toolbar, Popup).
Leave the other properties as they are for now. Later, while installing your application for users, you can customize these properties to control how the menu bar behaves. Once you're done, click Close to exit the Toolbar Properties dialog.
You may notice that the small, empty toolbar we saw earlier seems to have vanished. Don’t worry—it hasn’t gone far. To locate it, go back to the Toolbars tab, uncheck the MyMenuBar item, then check it again. Repeat this a few times quickly, and you’ll see the empty menu bar briefly appear and disappear—it’s playing a bit of hide-and-seek near the top of the application window. Once you’ve spotted it, we’re ready to continue building it.
To begin building your custom menu, you first need to create meaningful menu headings that can expand into drop-down lists, just like the standard File, Edit, or View menus.
-
Open the Customize dialog and click on the Commands tab.
-
You’ll see two lists: Categories on the left and Commands on the right.
-
In the Categories list, select File (if it’s not already selected).
-
From the Commands list, note the first two items: Custom and New.
-
Custom creates a menu item with just a text label—no image.
-
New creates an item that includes a button image and a label. You can configure it to show just the image, just the text, or both.
-
However, neither Custom nor New can be used to create a drop-down menu, like those you see under File or Edit. For that, we’ll need a different command control, which we’ll explore next.
Scroll down the Categories list until you find an item called New Menu near the bottom—select it. Once selected, the Commands list on the right will display an item also named New Menu. This is the control you need to create a drop-down-style menu, just like the ones under File or Edit in standard applications.
To build a complete Custom Menu Bar, you will use:
-
Custom (for plain text menu items),
-
New (for items with icons and text), and
-
New Menu (for drop-down menu structures).
These three options are the basic building blocks of your custom menu bar.
Customizing Menu Options.
- Click and drag the New Menu item from the Commands list and drop it onto your newly created empty menu bar. This will add a drop-down menu placeholder. Click on it to display a small empty drop-down where we’ll add our custom menu options.
-
Now, right-click on the New Menu item to open its properties, and change its name. In the Name: field, type
&Main
(We are using a custom name instead of the usual "File") and press Enter to confirm. The
&
(ampersand) symbol before a character—here before M—enables keyboard navigation: pressing Alt+M will open this menu. You can place the&
before any letter in the name to assign it as a shortcut key. That character will appear underlined in the menu bar, similar to how built-in menu names have one underlined letter each.However, be cautious when choosing shortcut letters. Avoid using characters already assigned to built-in menus to prevent conflicts with default keyboard shortcuts. For example: Assume that you have given & symbol at the left side of D in Data Files Menu and you are in the database window and the Forms Tab or Report Tab is active, if you execute the Alt+D keyboard shortcut, the selected Form, Report or whatever object currently have the focus on will open up in Design View. For the safer side, we will not give the ampersand symbol in any of the other menu options for now.
We will create three more Menu headings: Data Files, Process, Reports, and Utilities (another name for Tools). Follow the same steps explained above and create the Menu Headings.
We will primarily focus on creating custom menu options for Data Files, Process, and Reports—each designed to run our own program or macro-driven methods. In the Main and Utilities menus, we’ll also include some essential built-in options by copying and adding them as needed.
Let’s start with the easier task—adding built-in options to the Main and Utilities menus. To manage our MyMenuBar more conveniently, we’ll first push it above the built-in menu bar, making it easier to copy and drop (not drag and drop—yes, you guessed that right!) menu items or submenus into our custom menu.
If you’re not already in Customize mode, go to the View menu, select Toolbars, and click Customize.
As a demonstration, we’ll copy four built-in options—Close, Page Setup, Print, and Exit—from the built-in File menu and add them to our Main menu.
There are many references and options available for creating Custom Menus and Toolbars. At first, the process may seem difficult or even a bit cumbersome, but as you gain experience, you'll find it much easier—and quite rewarding too.
Drag-Drop Menu Items.
- Click on the built-in File menu to display its drop-down list. Click and hold the mouse button on the Close menu item, and while doing so, press the Ctrl key with your other hand. You’ll notice a plus (+) symbol appear next to the item—this indicates that a copy of the selected option is being made, rather than removing it from the built-in File menu. Now, drag the item up to the Main menu of your custom Menu Bar to display its drop-down area, and then drop the Close option there.
Follow the same procedure to copy the Page Setup, Print, and Exit options, placing them one below the other—or in between existing items, depending on your preference.
If you'd like to group certain options (for example, Page Setup and Print as part of a common group), right-click on the top item of that group and select Begin a Group from the context menu. This will insert a horizontal line above the selected item, visually separating it from other menu options.
Note: If you accidentally modify a built-in Menu Bar—for example, by dragging the Print option out of the File menu instead of copying it—the item will be removed from the original menu. However, any changes made to built-in Menu Bars, Toolbars, or Shortcut Menus can be easily restored.
To reset them to their original state, open the Customize dialog, select Menu Bar from the Toolbars tab, and click the Reset button.
We will continue our discussion shortly on Data Files, Process & Reports Menu options, where we plan to introduce our own simple Programs & and Macros to open Forms, Reports, etc.
[...] are two links that you can start with: http://www.msaccesstips.com/2007/07/...and-tool-bars/ http://www.learnaccessnow.com/chap19b.html can you attach the sample file converting it to Ms [...]
ReplyDeleteI am quite brand new to this kind of blog discussion stuff yet Im willing to aid and learn a lot, I really hope. Specifically in relation health and also the particular aspects of diet and in my situation physical exercise.
ReplyDeleteAt any rate, merely saying howdy and wish to get along with for some time.
i have recently ventured to learn ms access. I was v foxpro user. The environment is quite new to me but the websites like this one have helped me a lot to catch at the essential basics.
ReplyDeleteSpecially there are very useful videos at 'youtube' that help grasp basic ideas to toddle along the path of learning access with confidence.
[...] and Reports in Menu Bars and open them from there, is that right? Check the following links: Custom Menus and Toolbars Custom Menus and Toolbars-2 __________________ http://www.msaccesstips.com (Learn MS-Access [...]
ReplyDelete