MenuBar - hide it immediately


Jack Leach


I'm try to *immediately* hide the MS Access main menu bar in my startup
code. Under Tools -> Options I have my replacement set, and this works fine,
except the default menu doesn't get replaced with my custom menu until after
my startup code runs (this leaves anywhere from 1second to 5seconds of the
Access menu there during startup, which I would like to remove).

The following line produces an error:

Application.CommandBars("Menu Bar").Visible = False

Error: -2147467259(800004005)
Automation Error
Unspecified Error

I had thought to include this as one of the first lines in my startup to get
rid of it right off the bat...

Startup Summary...

Autoexec Macro
CheckRef() (reference verification)
Hide main menu??? <----
Verify core files and connections, settings, etc
Load properties and settings
Set "logged out" state
(this is about where the menus visibly change)
Open user login form
End AppLoad

Any ideas on why it's taking access this long to replace the main menu with
my custom one, or how I can explicitly hide it on startup?

I suspect that this may be part of Access's load procedure(s) rather than my
projects load procedures, but would love to have that not visible during
*any* part of the startup, if at all possible.


Jack Leach

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Albert D. Kallal

You don't need nor should be using any code to hide the built in menu bars

Just use the tools->startup to set your custom one.

If you launch your application with the /runtime switch, you will NOT see
the ms-access built in ones appears (except for the limited ms-access
runtime one).

Other additional benefits of using the runtime means that the access icon
NEVER shows if you have a custom icon setup. (again, a generic windows icon
shows until your specified one kicks in).

And another benefit of the /runtime switch is that the shiftkey by-pass is
also disabled.

So, best approach is no code at all and using the /runtime switch.



Jack Leach

I've never used the /runtime switch, and don't think I'm prepared for it at
the moment (I currently rely on being able to right-click a report preview to
print it... from what I gather I will lose this functionality when in
run-time mode?).

If I understand correctly, using the /runtime switch will run the project as
if it were being ran from the runtime executable (even though all of my
clients have the full version)?

In any case, I'm guessing that if I did do this, I would still see the
(reduced) main menu until my custom one kicks in.

I'll give it a shot, but it may take me a little while to develop a
workaround for not having the popup menu in report preview.

Jack Leach

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to hide the menubar in Access 2007 4
MenuBar Question 1
Export menubar 1
MenuBar properties 9
How to control menubar 2
Change menubar - VBA 0
Change a MenuBar at Runtime 1
Immediate Window 2