how to show/hide ribbon or navigation pane by VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help me how to show/hide the Ribbon or Navigation Pane in Access 2007
by VBA.
Thanks a lot!
 
Two things here. Let's look at them:

1. Hide navigationpane: Under Officebutton (that round circle with the
officelogo in it) Click on that. Choose - Access options (bottom Right) -
Choose option "Current database" from menu on the left; Look in second
section - checkbox to hide nav. pane.

2. The ribbon cannot be hidden by default. You can minimize it a bit by
using ctrl-F1 but it is still visible. If you want all the options of the
regular ribbons to dissapear you have to write your own "Ribbon" and
implement this in your DB. Info on this can be found at:
http://www.accessribbon.com/

So on short Nav. pane can be hidden Ribbon not.
 
Thanks for your help. But I want to show/hide NP and Ribbon by code (Visual
Basic for Application) in order to get more space for displaying forms. Would
you pls show me how to do it by VBA code!
Thanks so much!
 
Didane,

Hiding the nav.pane from code is not an option you would do from code. What
if the code gets corrupted... Just hide it from the Access options. In regard
to the ribbon.. well your stuck on at least something because you cannot hide
that Officebutton and you should always have at minimum one ribbon showing.
In code you could work with someting like Send Keys (ooopss... can't believe
I just suggested that to you..). Why don't you try looking at..
www.accessribbon.com

hth
 
Didane,
I have learned that removing the option to "Allow Full Menus" under "Access
Options:Current Database" will reduce the ribbon options to just the "Home"
tab, and will also remove the "Access Options" button from Access icon menu.
I haven't tried it yet, and don't remember exactly how to get it back, but
you might check into that.

Regarding Maurices comments,
I have been having the same problem as Didane. Apparently, there is a
school of thought that there is no good reason to show/hide the navigation
pane via VBA code. I completely disagree, and feel that this is definitely a
security issue for the databases I work on. I have many clients who use
Access databases for purposes that have become "mission critical" to their
respective businesses. For these clients, it is important to control
practically every aspect of user interaction with screens, reports, etc. The
database I'm working on right now was tight as a drum when I got it. It even
deletes all of the links to the tables in a back-end database at startup, and
won't refresh without a valid password (you really don't want more
explanation that that). It consists of one primary screen to which everything
else is subjugated. The user does not have the option to open or close the
primary screen. The user "lives" there. It is the one and only screen they
have to work with. However, the myriad objects it references have to be
available for development. The ability to work with the objects which are
now wide-open in the Navigation Pane, were completely hidden behind code that
controlled the use of Special keys, and checked security clearances. To
figure out how to get into it, you either just had to know the "secret
combination", or hack it from outside. I have no doubt my client is going to
be really ticked when they find out that it is so easy to get to the
Navigation Pane and everything right out there in the open.
 
You can use the same vba script to hide and show the navigation pane that are used for the show and hide the database window in Access 2003.

To hide the pane use:

DoCmd.RunCommand acCmdWindowHide

To Show the pane:

DoCmd.SelectObject acTable, , True
 
You can also just use the name "Ribbon" to hide it.

Docmd.ShowToolBars "Ribbon",acToolBarNo


I would also recommend writing a Function in a module that will turn it back on. Unlike Access 2003, the toolbars do not come back when you go back into design mode.
 
connorjoe said:
You can use the same vba script to hide and show the navigation pane that are used for the show and hide the database window in Access 2003.

To hide the pane use:

DoCmd.RunCommand acCmdWindowHide

To Show the pane:

DoCmd.SelectObject acTable, , True

DoCmd.RunCommand acCmdWindowHide actually just hides the active window, it has no direct relation to the Navigation pane unless it's the only visible object in the application.
 
Last edited:
1. Hide navigationpane: Under Officebutton (that round circle with the
officelogo in it) Click on that. Choose - Access options (bottom Right) -
Choose option "Current database" from menu on the left; Look in second
section - checkbox to hide nav. pane.


Why every time I entered Access I need to checks this checkbox?
Why is this vanigation pane hidden by default in my computer?

Ron
 
You don't have to do it at all, if you don't want to. In most cases, we programmers hide this to keep users out of mischief. The navigation window defaults to be shown, rather than hidden.

In particular, I would prefer it to be shown while the front end is in my development area, but then need it hidden while my users are running the program.
 
You don't understand, I'm a programmer, and I want that navigation pane will appear every time I open Access.
 
To Un-Hide navigation pane: Under Office button (that round circle with the
office logo in it) Click on that. Choose - Access options (bottom Right) -
Choose option "Current database" from menu on the left; Look in second
section - Check the box to UN-hide nav. pane.

As I already stated, the navigation pane ordinarily defaults to show up every time you open Microsoft Access.

If yours is not currently doing so, you will want to make sure whether it has been minimized or not, and possibly hold the shift key going into Access and use the procedure you mentioned to set set it the way that you want it, right clicking on the round button, and putting a check into the "Navigation Pane" option.

Once you set this check box, it normally stays the way that you set it, with no further interaction. You should be able to leave Access and come back in, and the setting should stay the way you left it.

If that is not happening, then you have an unusual situation that I am not familiar with.
 
Back
Top