Access VBA - Hiding Navigation panes


I am using the following code to hide the navigation panes in an Access database on the load event of my main form.
One problem that I have is that without navigation how will I go in to see my Visual Basic code.
I only want to activate this code when I give it to a user. Am I going about things correctly here?

Private Sub Form_Load()
    Call oHide_Navigation(True)
End Sub

Sub oHide_Navigation(ByVal blnHide As Boolean)
    On Error GoTo EH
    If blnHide = True Then
        'To hide the ribbon, add this code to your form's OnOpen event.
        DoCmd.ShowToolbar "Ribbon", acToolbarNo
        'To restore it:
        DoCmd.ShowToolbar "Ribbon", acToolbarYes
    End If
    If blnHide = True Then
        'To Hide the Navigation pane via vba code, you can use:
        DoCmd.NavigateTo "acNavigationCategoryObjectType"
        DoCmd.RunCommand acCmdWindowHide
        'And to bring it back:
        DoCmd.SelectObject acTable, "MSysObjects", True
    End If
    Exit Sub
    MsgBox "There was an error trying to hide/show the Access navigation" & Err.Description & " nb5"
End Sub

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John TsioumprisSoftware & Systems EngineerCommented:
Just open the database holding Shift...this will disable the code
Dale FyeOwner, Developing Solutions LLCCommented:
I generally do something like:

If fOSUserName = "admin" Then
    'do nothing
    'hide nave pane

if you are not famiiar with fOSUserName() you can download it from:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fabrice LambertConsultingCommented:
Or alternatively, hit ctrl + F11 to bring up the VBA editor.

You can hide the navigation pane or ribbon, but keyboard shortcuts still work.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.