Hide Ribbon & Nav window yay (1 Viewer)

NigelShaw

Registered User.
Local time
Today, 01:16
Joined
Jan 11, 2008
Messages
1,564
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
Code:
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
Code:
Public bolPress As Boolean
4. Change this line to represent your form. My form is called frmMAIN
Code:
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

Registered User.
Local time
Yesterday, 20:16
Joined
May 17, 2007
Messages
1,919
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.

Code:
    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
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom