By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Custom Menu Bars unique to a database

Expert 100+
P: 126
I am close to completing my current project, but before I deploy it, I would like to place custom menu bars on either the forms (preferrably) or the Access menu bar. I know how to do this using Toolbars -> Customize, but whenever I try to run the project elsewhere (ie. on a different machine), the menu bars have reset.
How can I ensure that my project will display the same custom menu bar on any computer running Access 2003?

Thanks.
Aug 16 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 126
I am close to completing my current project, but before I deploy it, I would like to place custom menu bars on either the forms (preferrably) or the Access menu bar. I know how to do this using Toolbars -> Customize, but whenever I try to run the project elsewhere (ie. on a different machine), the menu bars have reset.
How can I ensure that my project will display the same custom menu bar on any computer running Access 2003?

Thanks.
I think I'm beginning to see how to add a menu to the default menu bar (which is all I need to do), but how do I check if this menu exists first, ie. IF (my_menu) DOESNT EXIST THEN add it
Aug 17 '07 #2

Expert 100+
P: 126
I've managed to add a menu to the menu bar using:
CommandBars.ActiveMenuBar.Controls.Add(Type:=1, before:=1).Caption = "Test", the only trouble now is that it's just an empty box - no text or image. If I right click on it and change it's style to "Text Only (Always)" this solves the problem, but how can I do this from code?
Aug 17 '07 #3

Expert 100+
P: 126
I finally solved this, and I am going to post the answer here in case anyone else has a similar issue:

The "menu bar" CommandBar is default to Access, and stored in the registry. This means any changes affect any database on that computer, but not the same database on a different computer.

Custom menu bars are stored in the .mdb (or .mde) file, and so are unique to the database.

So, two ways of solving the problem:
Creating two files - original command bars and new command bars as an export from the registry, then using VBA to execute either a shell or regedit direct with <windir>\REGEDIT.EXE /s newmenus.reg when the database loads, and <windir>\REGEDIT.EXE /s oldmenus.reg when it closes.

If you are looking to do this, the command bars are stored in:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\A ccess\Settings\CommandBars
But I don't recommend it for two reasons:
1. If you package your database with just the runtime Access, the original menu bar isn't (as far as I know) visible anyway.
2. If the program doesn't shut down correctly, the user will be left with your menus.

The other way to do it, which is much simpler is, just create your own custom menu bar (several tutorials online for doing this), and copy some items from the original menu bar if you need them (be careful about altering them though - they are pointers, not copies, so any changes will change the registry version).
Then, to hide the old menubar, ON LOAD:
CommandBars("menu bar").enabled = False
This will, hopefully, provide you with unique menu bars for your professional looking database.

I hope this saves someone from spending the hours I did researching.
Aug 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.