Share via

Show/hide Navigation Pane

Anonymous
2013-11-20T18:07:13+00:00

Access 2010. Need to show and hide the Navigation Pane with code or a macro. Tried RunMenuCommand / WindowHide but it did not work. Well, it hid the Nav Pane but then I tried a macro to RunMenuCommand / WindowUnhide and put it on the Quick Access Toolbar and it DID NOT WORK.

Can write code if I knew the commands to use.

Please help.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2013-11-22T16:36:14+00:00

    Macros can only run Functions. Make these 2 changes:

    Public Sub HideDatabaseWindow(fHide As Boolean)

     -to-

    Public Function HideDatabaseWindow(fHide As Boolean)

    -and-

    End Sub

    -to-

    End Function

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-11-20T18:25:26+00:00

    This should work.

    Public Sub HideDatabaseWindow(bolHide As Boolean)

    'Purpose  : Hide or show the database window/navigation pane.

      On Error GoTo err_PROC

      'Set focus on the database window/navigation pane

      DoCmd.SelectObject acTable, "", True

      If bolHide Then

        DoCmd.RunCommand acCmdWindowHide

      Else

        On Error Resume Next

        DoCmd.RunCommand acCmdWindowUnhide

      End If

    exit_PROC:

        On Error Resume Next

        Exit Sub

    err_PROC:

        Dim strErrMsg As String

        Dim lngErrIconBtn As Long

        strErrMsg = "Error " & Err.Number & " (" & Err.Description & ") " _

                & "occurred in procedure HideDatabaseWindow of " _

                    & "VBA Document modApplication"

        lngErrIconBtn = vbOKOnly + vbInformation

        MsgBox strErrMsg, lngErrIconBtn, "Error"

        Resume exit_PROC

    End Sub

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2013-11-22T20:52:27+00:00

    Good! Thanks for letting me know.

    0 comments No comments
  4. Anonymous
    2013-11-22T18:52:06+00:00

    Bill,

    Thanks, it now works like a charm!!!

    Regards,

    NVMaxine

    0 comments No comments
  5. Anonymous
    2013-11-20T22:35:25+00:00

    Bill,

    I'm not sure what I am doing wrong. I have a module called Utilities which contains functions. I copied & pasted your Public Sub into this module and then created macros to run it with True and False parameters.

    Can't get it to work. What am I doing wrong?

    Thanks in advance.

    0 comments No comments