Not sure if this a bug or something wrong with my coding or where I call it.
I’ve been playing with VBA to hide the main menu. I’ve put this in my start form’s on-load event that gets called from an autoexec macro.
CommandBars.ActiveMenuBar.Enabled = False 'Turn Access Menu Bar off
This works fine and the main menu bar disappears. The problem is that after I exit the database and open any other database (databases where I do not want to hide the menu) the menu is also hidden. I even tried putting code on exiting the database to turn the menu back on but that didn’t work either.
CommandBars.ActiveMenuBar.Enabled = True 'Turn Access Menu Bar on
I do not understand why this code in one database would affect the menu bars in other databases. I thought maybe there was a problem with my Access program. But I copied the database to another computer and the same thing happens.
The only way to get it back is to either:
Press shift and launch the database. The menu bar is still hidden. Press Alt-F11 to go into the visual basic. Then right click on a Menu Bar and select Customize... highlight the Database menu bar and press the properties button. Press the Restore Defaults button.
The other way is to put this code in the load event of the start-up form
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = True
Next i
This maybe fine for my own database as I know how to get the main menu bar back, but I can’t give the database to other users and mess up their computer.
Anyone have any experience with this? Am I doing something wrong? Or should I be calling up something completely different in order to hide the main menu. I've searched this forum and others and all seem to show that the VBA I put in the load event should work.
Thanks
Using Access 2003
I’ve been playing with VBA to hide the main menu. I’ve put this in my start form’s on-load event that gets called from an autoexec macro.
CommandBars.ActiveMenuBar.Enabled = False 'Turn Access Menu Bar off
This works fine and the main menu bar disappears. The problem is that after I exit the database and open any other database (databases where I do not want to hide the menu) the menu is also hidden. I even tried putting code on exiting the database to turn the menu back on but that didn’t work either.
CommandBars.ActiveMenuBar.Enabled = True 'Turn Access Menu Bar on
I do not understand why this code in one database would affect the menu bars in other databases. I thought maybe there was a problem with my Access program. But I copied the database to another computer and the same thing happens.
The only way to get it back is to either:
Press shift and launch the database. The menu bar is still hidden. Press Alt-F11 to go into the visual basic. Then right click on a Menu Bar and select Customize... highlight the Database menu bar and press the properties button. Press the Restore Defaults button.
The other way is to put this code in the load event of the start-up form
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = True
Next i
This maybe fine for my own database as I know how to get the main menu bar back, but I can’t give the database to other users and mess up their computer.
Anyone have any experience with this? Am I doing something wrong? Or should I be calling up something completely different in order to hide the main menu. I've searched this forum and others and all seem to show that the VBA I put in the load event should work.
Thanks
Using Access 2003