Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling the default menu...also kudos to Billpower 3

Status
Not open for further replies.

docin

Technical User
Aug 7, 2003
12
US
Hi,
I've searched thru the faq and forums on this subject, but I can't seem to get any of the suggestions to work for me. I want to either disable the default menu when my application starts or better yet, just remove some of the items from the default menu bar. I can hide the menu by using the onopen event in my form, but it only seems to work when I am in Access and open the form, when I start the application, the form loads but so does the default menu. I think I'm missing something really simple here, but I've wasted a lot of time "playing" with this.
I can't seem to get the DoCmd.ShowToolbar "Menu Bar", acToolBarNo thing to work...and I have the show/hide tick mark box checked.
Just a quick note...to Billpower..I've found a lot of helpful ideas by searching old posts..and your name keeps coming up...I remember it because you helped me a long time ago with your "Transposer code".. It seems you are still helping a lot of people...just wanted to say Thanks.
 
The way that I control this is with a custom menu bar. I create a custom menu bar and then unter Tools - Startup, I change the default menu bar to my custom one.
 
First, forget about modifying the default menu. Unlike most other menus, the default menu bar is part of your computer's installation of Access. Any changes you make to it are effective for all databases on your computer, but have no effect at all on other people's computers.

Instead, you need to create a custom menu bar, add custom menus to it using the "New Menu" item in the command list, and copy individual menu commands from the default menus (by holding down Ctrl as you drag them to your menu).

Note: DO NOT attempt to copy whole menus from the default menu bar. When you do this, you get your own copy of the menu, but the items on the menu are really just pointers to the same CommandBarControl object as the default menu items. If you delete an item from the custom menu, it will disappear from the default menu, and if you reset the default menu bar, the items will reappear on your custom menu. You have to create custom menus and copy each individual item.

When you have your custom menu built and tested, put its name in the Application Menu Bar box in the Tools>Startup property dialog. Your menu bar will replace the default menu bar when your database is opened, and the default menu bar will be restored when your database is closed. While you're developing, you can switch between your custom menu bar and the default by keying Ctrl-F11. (Note that this is one of the "special keys" disabled by the Allow Special Keys option in the Startup dialog, so you can turn it off before you deliver the application to your users.)

About showing/hiding the default menu bar in a startup form:
It can't be done. Access opens the startup form before it processes the StartUpMenuBar property, and until it does the latter you can't affect what happens. The startup form's Open, Load, Activate, and GotFocus events will all happen before Access decides which menu bar should be shown.

Another downside of Access' startup processing is that if your startup form interacts with the user during the Open event, the default menu bar will be visible to the user. For this reason, it's a good idea to make that startup form modal!

Here's a workaround: In the Open event of your startup form, set your TimerInterval to 10. In the Timer event, modify your menu bars as needed and set TimerInterval to 0. As long as your startup form finishes opening before the timer goes off, you will be able to hide the default menu bar. (But if you're using a custom menu bar, you shouldn't actually need to do this anyway.)

Curiously, by the time the AutoExec macro runs, the menu bar choice has been made and activated. You can switch menu bars however you want. That's why I always use an AutoExec macro in my own end-user applications, even if I also use a Startup Form.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Thanks mkov and Rick, Looks like the custom menu bar is the way to go. Rick, thanks so much for the detailed information on access start up process. I appreciate the response. I give you both a star..
 
according to a2k's 'menu bar property' help:

"If you set the MenuBar property to a value that is not the name of an existing menu bar or menu bar macro, the form or report will not have a menu bar (the default menu bar will not be shown)."

in my database, it opens to a switchboard menu created using the 'wizard'. i note that the menu bar property is set to '=1' which i take it is to override the default menu bar. i would like to modify the menu bar that IS appearing atop the screen but how? the functions currently not stippled out are: save, print, preview, find, properties, database window, new object: table, and a2k help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top