UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> Use F11 to Show/Hide Navigation Pane    

When debugging your application, the F11 key is very useful in opening the Navigation Pane, but when pressed again, the F11 key minimises the nav pane rather than closing, or hiding, it.

This simple routine captures the F11 key using the AutoKeys macro and Opens or Hides the Nav Pane with each press of the F11 key. An additional check in the code disables the function if the application is an accde file, preventing users, with a distributed (accde) application file, using the F11 key to open the nav pane and accessing other objects in your database:

Create a New Macro

a. Set first entry in the ‘Macro Name’ column to "{F11}"
b. Set the Action column entry  to "RunCode"
c. Set the argument entry  to "SwitchNavPane()"
d. Save the Macro with the name: "AutoKeys"

Create a new function in a module:

CODE
Public Function SwitchNavPane()
On Error Resume Next

' Shows and Hides the Access 2007/2010 Navigation Pane Using the F11 Function Key
' http://www.UtterAccess.com/wiki/index.php/Use_F11_to_Show/Hide_Navigation_Pane
' Code courtesy of UtterAccess Wiki
' Licensed under Creative Commons License
' http://creativecommons.org/licenses/by-sa/3.0/
'
' You are free to use this code in any application,
' provided this notice is left unchanged.
'
' rev  date        brief descripton
' 1.0  2012-07-18    
'
   Dim strMDE As String
   Static bolHidden As Boolean
   
   'if this is an executable file (accde) then exit function
   strMDE = CurrentDb.Properties("MDE")
   If Err = 0 And strMDE = "T" Then Exit Function
       
   'Select object (table) in navigation pane - forces focus to table and navigation pane to open if closed
   'Table name must be a valid table name in database
   DoCmd.SelectObject acTable, "tblAdmin", True        
   'If navigation pane open then close
   If bolHidden = 0 Then DoCmd.RunCommand acCmdWindowHide
   bolHidden = Not bolHidden

End Function

http://www.utteraccess.com/wiki/index.php/Image:Switch_Nav_Pane_Demo.zip


Creative Commons License
Use F11 to Show/Hide Navigation Pane by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.[/code]

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 8,720 times.  This page was last modified 14:37, 19 July 2012 by Pere_de_chipstick.   Disclaimers