Getting rid of the menu bars (1 Viewer)

GregSmith

Registered User.
Local time
Today, 10:43
Joined
Feb 22, 2002
Messages
126
I have a mdb that opens up and loads my form. What I would like to do is get rid the MS Access toolbars. Is there away to do this??
 

Alexandre

Registered User.
Local time
Today, 22:43
Joined
Feb 22, 2001
Messages
794
This is one case where you would like to look into macros. There is one (ShowOrHideToolbars I believe that does just that). You would write a macro hiding the various built-in toolbars and call it autoexec...
 

ghudson

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2002
Messages
6,195
This will allow you to hide and unhide all tool bars and menus.

'Put this in your forms OnOpen event:
Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = False
Next I

'Put this in your forms OnClose event:
Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = True
Next I

An added bonus is the right click option is disabled if the menu bars are disabled with this code.

HTH
 

vangogh228

Registered User.
Local time
Today, 11:43
Joined
Apr 19, 2002
Messages
302
Is there a way to display ONLY a custom toolbar? I would like to create a toolbar of just sort and filter functions and only have that display. Thanks!!
 

ghudson

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2002
Messages
6,195
Use my code above to hide all toolbars and use this to show your custom toolbar...

DoCmd.ShowToolbar "YourCustomToolbarNamehere", acToolbarYes

HTH
 

vangogh228

Registered User.
Local time
Today, 11:43
Joined
Apr 19, 2002
Messages
302
ghudson:

THANKS!!! I will note this code for future use MANY times!!

Tom
 

vangogh228

Registered User.
Local time
Today, 11:43
Joined
Apr 19, 2002
Messages
302
ghudson:

Can you clarify one additional thing for me? I have one form database form that is the default open form... that I have tagged an Open event of a macro that maximizes the form. Is there a way I can maximize the form on open and run the open code that opens my toolbar?

The toolbar I have is called "ICAN toolbar." Could you help with the code on combining these open events? THANKS!!!

Tom
 

Carolyn

Registered User.
Local time
Today, 10:43
Joined
Jun 14, 2002
Messages
28
ghudson,

Oh MY Gosh! How do I get them back?

Carolyn
 

Carolyn

Registered User.
Local time
Today, 10:43
Joined
Jun 14, 2002
Messages
28
I guess I should mention that I put this code on the switchboard and so it has effected all the forms. reports, EVERYTHING! I'm not sure how I am going to make changes to the DB without them. Thank you.

Carolyn
 

ghudson

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2002
Messages
6,195
vangogh228,

Put this in the main forms OnOpen event to hide all tool bars and menu bars, maximize the form and show your custom "ICAN toolbar" tool bar...

Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = False
Next I
DoCmd.Maximize
DoCmd.ShowToolbar "ICAN toolbar", acToolbarYes

HTH
 

ghudson

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2002
Messages
6,195
Carolyn,

I normally use security so I test for the current users workgroup name and hide or unhide the tool bars as needed. Or you could add the unhide all tool bars code to a command button of your choice. I prefer to add a double click event to a forms label to unhide the tool bars in a non secured db. That is my trick to unhide the tool bars since the users are not going to double click a label.

If CurrentUser = "programmer" Then 'unhide all tool bars and menu bars
Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = True
Next I
Else 'hide all tool bars and menu bars
Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = False
Next I
End If

HTH
 

Carolyn

Registered User.
Local time
Today, 10:43
Joined
Jun 14, 2002
Messages
28
Thank you ghudson,

I like that idea a lot. I did search the archives and found that if you hold down on the shift key while opening the DB it bypasses all the startup options. Whew! Have a great day:)

Carolyn
 

ghudson

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2002
Messages
6,195
show/hide tool bars example db

I have attached a sample db that has two forms. Each uses a different method to hide or show all tool bars and menu bars. The db also has a custom tool bar and menu bar. There is one public module with the code to hide or show all tool bars where appropriate.

HTH those in need!
 

Attachments

  • showhideenabledisabletoolbarsmenubars.zip
    45.5 KB · Views: 314

Users who are viewing this thread

Top Bottom