Hide Navigation Page using VBA (1 Viewer)

jaydwest

JayW
Local time
Today, 01:07
Joined
Apr 22, 2003
Messages
340
I would like to expose the Navigation Pane when I run an MS Access 2007 database but hide it when other users run it.

I was hoping for

Application.SetOption "Hide Navigation Pane", true/false

But Access doesn't like this. What is the code I should use?

Thanks for your help.
 

HiTechCoach

Well-known member
Local time
Today, 02:07
Joined
Mar 6, 2006
Messages
4,356
With 2007, the only way I have found to keep the Nav pane hidden is to use Access in runtime mode.

Is your database split?

Are the users using an ACCDE (or renamed to ACCDR) fron t end?
 

jaydwest

JayW
Local time
Today, 01:07
Joined
Apr 22, 2003
Messages
340
THe database is an old MSA2003 database in mdb format.

Sounds like I can't set this option programmatically.

THanks for your help.
 

vbaInet

AWF VIP
Local time
Today, 08:07
Joined
Jan 22, 2010
Messages
26,374
This has always worked for me (even in 2007):

CurrentDb.Properties("StartUpShowDBWindow") = False
 

jaydwest

JayW
Local time
Today, 01:07
Joined
Apr 22, 2003
Messages
340
I inserted the line of code. It ran but did not change the display of the Navigation Pane.

Thanks.
 

vbaInet

AWF VIP
Local time
Today, 08:07
Joined
Jan 22, 2010
Messages
26,374
Just tested it and it works perfectly on mine. You do realise that it's a startup option and it doesn't take effect until after you've closed and reopened the database?
 

HiTechCoach

Well-known member
Local time
Today, 02:07
Joined
Mar 6, 2006
Messages
4,356
To hide the nav pane after the database is already opened use:

Code:
Public Sub HideNavPane()
    DoCmd.SelectObject acTable, "tblMyTable", True
    DoCmd.RunCommand acCmdWindowHide
End Sub

You will need to replace "tblMyTable" with one of your actual table names.
 

tonyluke

New member
Local time
Today, 00:07
Joined
May 4, 2010
Messages
4
Hi there, I've been using the SelectObject/acCmdWindowHide to hide the navigation pane during runtime, however it doesn't work whenever the active form's modal property is set to true. I'm assuming that this is because the modal property is preventing me from selecting anything outside of the form, however, I need the form to be modal, and the navigation pane keeps re-appearing every time I link or import a table programatically.

Does anybody know an alternative method to hide the navigation pane during runtime without using the SelectObject/acCmdWindowHide commands?

Thanks in advance for any help,

Tony
 

HiTechCoach

Well-known member
Local time
Today, 02:07
Joined
Mar 6, 2006
Messages
4,356
Hi there, I've been using the SelectObject/acCmdWindowHide to hide the navigation pane during runtime, however it doesn't work whenever the active form's modal property is set to true. I'm assuming that this is because the modal property is preventing me from selecting anything outside of the form, however, I need the form to be modal, and the navigation pane keeps re-appearing every time I link or import a table programatically.

Does anybody know an alternative method to hide the navigation pane during runtime without using the SelectObject/acCmdWindowHide commands?

Thanks in advance for any help,

Tony

Tony,

Try running Access in Runtime mode.

A simple way to test this is to rename your database to have the extension .accdr

or

create a short cut with the /runtime switch
 
Last edited:

tonyluke

New member
Local time
Today, 00:07
Joined
May 4, 2010
Messages
4
Thanks HTC,

Using Access in runtime mode prevents anyone from seeing the navigation pane, which is the desired effect.

I need the navigation pane to be hidden when access is not set to runtime mode as well (for those savvy enough to work out how to change the extension back, or find the target of the shortcut), and have adjusted my code in the following way:

Code:
'At first I had:
 
Public Function HideIt()
[INDENT]DoCmd.SelectObject acTable, "Employee", True
DoCmd.RunCommand acCmdWindowHide
[/INDENT]End Function
 
'Now I have:
Public Function HideIt()
[INDENT]DoCmd.SelectObject acTable, "Employee", True
If Application.CurrentObjectName = "Employee" Then DoCmd.RunCommand acCmdWindowHide
[/INDENT]End Function

Thanks for your help,

Tony
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:07
Joined
Jan 20, 2009
Messages
12,462
Note that you will also have to disable Use Access Special Keys in the Access Options for the database. Otherwise hitting F11 will show the Navigation Pane.

Even if you do this a user can reenable the setting. Perhaps you could trap the F11 key event in VBA to defeat it.
 

anski

Registered User.
Local time
Today, 15:07
Joined
Sep 5, 2009
Messages
70
Thanks HTC,

'Now I have:
Public Function HideIt()
DoCmd.SelectObject acTable, "Employee", True
If Application.CurrentObjectName = "Employee" Then DoCmd.RunCommand acCmdWindowHide
End Function
[/code]Thanks for your help,

Tony

hi tony. where did you place this specific command?

i am also looking for ways to totally disable the navigation pane. changing the extension name to accdR helps but a user can change this extension name. what i want is even if the user can see the tables, they cannot be able to view OR CHANGE the data found in a table. any way i can do this?
 

tonyluke

New member
Local time
Today, 00:07
Joined
May 4, 2010
Messages
4
Hi anski,

The only way i've found to DISABLE the navigation pane (i.e. user cannot access the objects, even though the pane is visible) is to set the modal property on all of your forms to True.
Unless I'm running the app in runtime mode, the navigation pane is still visible.

The only other thing I could think of, would be to include some code after any code you have that causes the navigation pane to appear (such as TransferDatabase commands) that:
a) sets the modal property of all open forms to false
b) hides the navigation pane using the method stated above; and
c) sets the modal property back to true

Messy though.

HTH
 

anski

Registered User.
Local time
Today, 15:07
Joined
Sep 5, 2009
Messages
70
thanks tonyluke. is there any way to disable data entry thru tables? i dont really mind if the user is able to see the data just as long as he cannot edit any of the data via tables? i've kinda given up on the navigation pane. so even if the user can activate the navigation pane BUT cannot edit data thru tables, i'm fine with that. thanks.
 

tonyluke

New member
Local time
Today, 00:07
Joined
May 4, 2010
Messages
4
I'm not sure if you're having the original problem that I was having. My problem was that the navigation pane was re-appearing after I'd run the TransferDatabase method in VBA.

If you're not using any such code, then there are a couple of ways that you can simply hide the navigation pane at startup, mentioned earlier in this post.
If you ARE using the TransferDatabase method, and you don't have any modal forms open at the time, then you can use the:

Code:
DoCmd.SelectObject acTable, "ATableName", True
DoCmd.RunCommand acCmdWindowHide

Method to hide it after it re-appears. You can place these 2 lines of code either after the TransferDatabase line, or in a Public Function in a module and just call it whenever there's any code that makes the nav pane re-appear.

If you are using the TransferDatabase method and you DO have modal forms open, then you'll find yourself in exactly the same position as me, and I don't have any other suggestions for you.

If your problem is different to this entirely, then I suggest starting a new thread and giving a bit more information about your specific problem.

Cheers,

Tony
 

isladogs

CID VIP
Local time
Today, 08:07
Joined
Jan 14, 2017
Messages
16,071
I just came across this thread which I realise is almost 10 years old.

As stated, doing an action such as transfer database with a modal form running will make the navigation pane visible if it was hidden.
For most purposes, this is useful behaviour so you can check if the action has worked
But where you need it to remain hidden, you can use code to hide the nav pane again immediately even where the form is modal

However this (unwanted) behaviour won't occur if you also hide the entire application window

See this example app for more details on controlling the application interface
https://www.access-programmers.co.uk/forums/showthread.php?t=293584
 

Attachments

  • TestModal.zip
    43.5 KB · Views: 201
Last edited:

Users who are viewing this thread

Top Bottom