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