Disable Menus

rblair11

Registered User.
Local time
Yesterday, 16:10
Joined
Nov 4, 2005
Messages
36
I have the following code in the on_load of all of my forms to disable all menus:

Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i

The problem is that when I open a report in preview mode I cannot close, print, etc.

Two questions:

1. Is the above approach the best way to disable all menus and toolbars?
2. How do I add a custom toolbar (already created) to the report preview only. I've tried doing in in the properties and by me.toolbar = "custom toolbar." Neither approach works. I suspect that the code I've used to disable the menus is keeping me from adding custom menus where I want them?

I should also mention that I have also turned off all of the menus, toolbars, etc. in the options/startup.

Thanks for your help!
 
Last edited:
Problem Solved

I was finally able to fix the problem. Here are the details in case it helps someone.

Ghudson's code to turn off all toolbars only needs to be inserted on the opening form. Then just reverse the code (change "false" to "true") on a form that you want to enable toolbars on. Then you can hide or unhide individual toolbars, including the menu bar, on that form. Be sure to invoke the original code again on the close event of the form.

Thank you ghudson for the original code, I was simply misusing it.
 

Users who are viewing this thread

Back
Top Bottom