Hide-Unhide Standard Menus Access 2007

jpindi

Registered User.
Local time
Today, 01:23
Joined
Jan 30, 2009
Messages
22
Hi All - I had a simple little VBA code written that works for MS Access 2003 but not for 2007. I believe it has to do with the menu names. Basically it was a list box that toggled the menus on and off. Here is the working code that I've tried to tweak by adding 'yes visible' for anything under the sun.

I tried also adding menu names that I thought were obvious ('Create' menu 'External Data' menu and so on) but it bombs out saying it cannot find those menus. So you'll see below I've commented those out. That big list of menus doesn't turn anything up, but we still have the odd 2003 user so I've kept them in.

As it stands now, clicking on the list box hides and unhides the 'Home' menu, but I also want it to show the other standard menus that appear when you open Access normally ('Create' 'External Data' and 'Database Tools' are the ones missing).

So as far as I can tell, I just need those standard menu names but can't find them. Help!

Code:
Private Sub listVisible_AfterUpdate()
Dim intVisible As Single

intVisible = Me.listVisible
If intVisible = 1 Then
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarYes '----yes to this
DoCmd.ShowToolbar "Form View", acToolbarYes '----yes to this
   DoCmd.ShowToolbar "Toolbox", acToolbarYes
   DoCmd.ShowToolbar "Database", acToolbarYes
   DoCmd.ShowToolbar "Ribbon", acToolbarYes
'   DoCmd.ShowToolbar "Create", acToolbarYes
'   DoCmd.ShowToolbar "External Data", acToolbarYes
'   DoCmd.ShowToolbar "Database Tools", acToolbarYes
       DoCmd.ShowToolbar "Menu Bar", acToolbarYes
    DoCmd.ShowToolbar "Database", acToolbarYes
    DoCmd.ShowToolbar "Relationship", acToolbarYes
    DoCmd.ShowToolbar "Table Design", acToolbarYes
    DoCmd.ShowToolbar "Table Datasheet", acToolbarYes
    DoCmd.ShowToolbar "Query Design", acToolbarYes
    DoCmd.ShowToolbar "Query Datasheet", acToolbarYes
    DoCmd.ShowToolbar "Form Design", acToolbarYes
    DoCmd.ShowToolbar "Form View", acToolbarYes
    DoCmd.ShowToolbar "Filter/Sort", acToolbarYes
    DoCmd.ShowToolbar "Report Design", acToolbarYes
    DoCmd.ShowToolbar "Print Preview", acToolbarYes
    DoCmd.ShowToolbar "Toolbox", acToolbarYes
    DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarYes
    DoCmd.ShowToolbar "Formatting (Datasheet)", acToolbarYes
    DoCmd.ShowToolbar "Macro Design", acToolbarYes
    DoCmd.ShowToolbar "Utility 1", acToolbarYes
    DoCmd.ShowToolbar "Utility 2", acToolbarYes
    DoCmd.ShowToolbar "Web", acToolbarYes
    DoCmd.ShowToolbar "Source Code Control", acToolbarYes
    DoCmd.ShowToolbar "Ribbon", acToolbarYes

Else
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarNo '----yes to this
DoCmd.ShowToolbar "Form View", acToolbarNo '----yes to this
   DoCmd.ShowToolbar "Toolbox", acToolbarNo
   DoCmd.ShowToolbar "Database", acToolbarNo
   DoCmd.ShowToolbar "Ribbon", acToolbarNo
End If
End Sub
 
Here is a thread that might help:
http://www.access-programmers.co.uk/forums/showthread.php?t=206281&highlight=ribbon

It only talks about hiding the Ribbon. If you need to have functionality in the Ribbon, you will need to create your own custom ribbon. Here is a link to information about the elements of the xml for creating a ribbon.
http://www.accessribbon.de/en/?Access_-_Ribbons:Ribbon_XML___Controls

There are also other packages that assist in creating ribbons. Here are links to two of them:
http://www.accessribbon.de/en/?Ribbon_Creator
http://www.ribbon01.com/index.htm
 
Thanks for your quick reply: So let me get this straight, getting the menus to appear like it used to work in 2003 doesn't work any more and I have to rebuild this 'ribbon' as it is now called from scratch using XML? That seems like a lot more work than it used to be, but is that right? I think the geniuses at Microsoft didn't really think this one through, if that's the case. So basically the
DoCmd.ShowToolbar is kind of useless, now, to I suppose....
 
Thanks, Mr. B. I guess if that's the only solution then that's the only solution. Now I remember
why I prefer website coding to MS Access...
 
...As a work-around I customized the quick access toolbar, just for my 'top' commands. Thanks again.
 

Users who are viewing this thread

Back
Top Bottom