Public Function ToolbarsOff()
On Error GoTo Err_ToolbarsOff
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Database", acToolbarNo
DoCmd.ShowToolbar "Relationship", acToolbarNo
DoCmd.ShowToolbar "Table Design", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Query Design", acToolbarNo
DoCmd.ShowToolbar "Query Datasheet", acToolbarNo
DoCmd.ShowToolbar "Form Design", acToolbarNo
DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Filter/Sort", acToolbarNo
DoCmd.ShowToolbar "Report Design", acToolbarNo
DoCmd.ShowToolbar "Print Preview", acToolbarNo
DoCmd.ShowToolbar "Toolbox", acToolbarNo
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarNo
DoCmd.ShowToolbar "Formatting (Datasheet)", acToolbarNo
DoCmd.ShowToolbar "Macro Design", acToolbarNo
DoCmd.ShowToolbar "Utility 1", acToolbarNo
DoCmd.ShowToolbar "Utility 2", acToolbarNo
DoCmd.ShowToolbar "Web", acToolbarNo
DoCmd.ShowToolbar "Source Code Control", acToolbarNo
DoCmd.ShowToolbar "Visual Basic", acToolbarNo
Exit_ToolbarsOff:
Exit Function
Err_ToolbarsOff:
If Err.Number = 2094 Then 'Can't find the toolbar. You tried to run a macro that includes a ShowToolbar action or a Visual Basic procedure that includes a ShowToolbar method.
Resume Next
Else
MsgBox Err.Number & " - " & Err.Description
Resume Exit_ToolbarsOff
End If
End Function
Public Function ToolbarsOn()
On Error GoTo Err_ToolbarsOn
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
DoCmd.ShowToolbar "Database", acToolbarWhereApprop
DoCmd.ShowToolbar "Relationship", acToolbarWhereApprop
DoCmd.ShowToolbar "Table Design", acToolbarWhereApprop
DoCmd.ShowToolbar "Table Datasheet", acToolbarWhereApprop
DoCmd.ShowToolbar "Query Design", acToolbarWhereApprop
DoCmd.ShowToolbar "Query Datasheet", acToolbarWhereApprop
DoCmd.ShowToolbar "Form Design", acToolbarWhereApprop
DoCmd.ShowToolbar "Form View", acToolbarWhereApprop
DoCmd.ShowToolbar "Filter/Sort", acToolbarWhereApprop
DoCmd.ShowToolbar "Report Design", acToolbarWhereApprop
DoCmd.ShowToolbar "Print Preview", acToolbarWhereApprop
DoCmd.ShowToolbar "Toolbox", acToolbarWhereApprop
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarWhereApprop
DoCmd.ShowToolbar "Formatting (Datasheet)", acToolbarWhereApprop
DoCmd.ShowToolbar "Macro Design", acToolbarWhereApprop
DoCmd.ShowToolbar "Utility 1", acToolbarWhereApprop
DoCmd.ShowToolbar "Utility 2", acToolbarWhereApprop
' DoCmd.ShowToolbar "Web", acToolbarWhereApprop 'I never allow this one because I hight use hyperlinks
DoCmd.ShowToolbar "Source Code Control", acToolbarWhereApprop
DoCmd.ShowToolbar "Visual Basic", acToolbarWhereApprop
Exit_ToolbarsOn:
Exit Function
Err_ToolbarsOn:
If Err.Number = 2094 Then 'Can't find the toolbar. You tried to run a macro that includes a ShowToolbar action or a Visual Basic procedure that includes a ShowToolbar method.
Resume Next
Else
MsgBox Err.Number & " - " & Err.Description
Resume Exit_ToolbarsOn
End If
End Function
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
</ribbon>
</customUI>
Actually, although I use 2007 on my machine, the original .mdb was created on a legacy workstation, thus it's not a accdb or accde
Is that going to be a problem?
Nice Bob, I like it! I'll give that a shot. Will I be able to restore the full ribbon bar once an administrator logs in?
I remember that in earlier versions of Access there was a key-combination that restored the default menus and the component browser. With what I'm trying to do restarting while holding shift won't work. In 2007 is there a similar key combo or command that I can execute to restore the default menus/nav page w/o restarting?
Nope, it all requires restarting (thanks to the way MS designed it).
What is the best way to turn all the menu bars and tools bars off and back on when a form opens and closes? Can you just loop through the numerated objects?