[AccessD] Toggle the Navigation Pane in A2010

Gustav Brock gustav at cactus.dk
Wed Oct 24 05:31:39 CDT 2012


Hi all

A client requested the option to toggle the Navigation Pane in A2010 by
pressing Ctrl+F2.
Perhaps you may find it useful:

<code>
Public Function EnableNavigationPane(Optional ByVal varEnable As Variant) As
Boolean

' Set or toggle if the Navigation Pane should be visible or not.
' Requirement: At least one form must exist in the database.
'
' 2012-10-24. Cactus Data ApS, CPH.
'
' Can be used with AutoKeys macro to be toggled with key combination Ctrl+F2
'
' Import AutoKeys by saving the following lines as a text file.
' Remove leading single quotes.
' Run this command:
'   LoadFromText acMacro, "AutoKeys", "d:\path\autokeys.txt"


'Version = 196611
'PublishOption = 1
'ColumnsShown = 0
'Begin
'    MacroName = "^{F2}"
'    Action = "RunCommand"
'    Argument = "2"
'End
'Begin
'    Action = "RunCode"
'    Argument = "EnableNavigationPane()"
'End
'Begin
'    Comment ="_AXL:<?xml version=\"1.0\" encoding=\"UTF-16\"
standalone=\"no\"?>\015\012<UserI"
'        "nterfaceMacro MinimumClientDesignVersion=\"14.0.0000.0000\"
xmlns=\"http://schem"
'        "as.microsoft.com/office/accessservices/2009/11/application\"
xmlns:a=\"http://sc"
'        "hemas.microsoft.com/office/acc"
'End
'Begin
'    Comment ="_AXL:essservices/2009/11/forms\"><Statements/><Sub
Name=\"^{F2}\"><Statements><A"
'        "ction Name=\"RunMenuCommand\"><Argument
Name=\"Command\">WindowHide</Argument></"
'        "Action><Action Name=\"RunCode\"><Argument
Name=\"FunctionName\">EnableNavigation"
'        "Pane()</Argument></Actio"
'End
'Begin
'    Comment = "_AXL:n></Statements></Sub></UserInterfaceMacro>"
'End

    
    Static strForm      As String
    Static booEnabled   As Boolean
    
    On Error Resume Next
    
    If strForm = "" Then
        ' Find and store name of first form.
        strForm = DBEngine(0)(0).Containers!Forms.Documents(0).Name
    End If
    If Not IsMissing(varEnable) Then
        booEnabled = Not CBool(varEnable)
    End If
    
    DoCmd.SelectObject acForm, strForm, True
    If booEnabled = True Then
        DoCmd.RunCommand acCmdWindowHide
    End If
    booEnabled = Not booEnabled
    
    EnableNavigationPane = booEnabled
    
End Function
</code>



More information about the AccessD mailing list