View Full Version : Hide Ribbon & Nav window yay


NigelShaw
03-06-2011, 09:25 AM
Hi,

for all you A2007 users.

After designing my form all nice and proportioned, i did a few final views with no NAV bar then with no ribbon only to find i had to have a re-think....

i dont want a ribbon or nav bar on my finished program so i made this simple temp button that you can add to a form while in design period and quickly switch between design and no nav or ribbon to see how the design works.

Procedure

1. Add a button (without the wizard)
2. Add this code behind it

Dim strForm As String

strForm = "frmMain"

Select Case bolpress
Case False
DoCmd.SelectObject acForm, strForm, True
DoCmd.ShowToolbar "Ribbon", acToolbarYes
bolpress = True
Case True
DoCmd.SelectObject acForm, strForm, True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo
bolpress = False
Case Else
bolpress = True
End Select

3. Make this variable public
Public bolPress As Boolean
4. Change this line to represent your form. My form is called frmMAIN

strForm = "frmMain"


Now you can easily switch between ribbon / no ribbon & nav bar / no nav bar without having to go through the motions


Cheers


Nigel

speakers_86
09-04-2011, 10:03 AM
I found a slightly better way in Access 07 and up. The select object command only seems to work for me if the category is expanded in the nav pane. If it is not, then the form itself is hidden. NavigateTo gets around this. Below is how I do it, but it's only the nav pane, not the ribbon too.

Select Case bolHideNavPane
Case False
DoCmd.NavigateTo "acnavigationcategoryobjecttype", "acNavigationGroupTables"
DoCmd.RunCommand acCmdWindowHide
bolHideNavPane = True
Case True
DoCmd.SelectObject acForm, Me.Name, True
bolHideNavPane = False
End Select