Options with navigation bar visible or not (1 Viewer)

stevekos07

Registered User.
Local time
Yesterday, 19:50
Joined
Jul 26, 2015
Messages
174
Hello. I know that there is an option to set the navigation bar as visible or not as a general option, but is there a way to have Access open with navigation bar accessible or not depending on an If statement on a login form? I would like to set up access to open with the navigation bar visible or not based on the username and password used to log in on a log-in form.
 

isladogs

MVP / VIP
Local time
Today, 03:50
Joined
Jan 14, 2017
Messages
18,261
Yes - its easy enough to do.
Set criteria to manage this when users login in e.g. do they belong to an admin group
Create a function to check this based on login info e.g. CheckAdminUser
Then add code like this:

Code:
If CheckAdminUser=True Then
    ShowNavigationPane
Else
    HideNavigationPane
End If

Below are the 2 functions to hide/show the navigation pane. Place these in a module.

Code:
Public Function ShowNavigationPane()

On Error GoTo ErrHandler

    DoCmd.SelectObject acForm, , True
    
Exit_ErrHandler:
    Exit Function
    
ErrHandler:
    MsgBox "Error " & Err.Number & " in ShowNavigationPane routine : " & Err.Description, vbOKOnly + vbCritical
    Resume Exit_ErrHandler

End Function

Code:
Public Function HideNavigationPane()

On Error GoTo ErrHandler

    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.RunCommand acCmdWindowHide
        
Exit_ErrHandler:
    Exit Function
    
ErrHandler:
    MsgBox "Error " & Err.Number & " in HideNavigationPane routine : " & Err.Description, vbOKOnly + vbCritical
    Resume Exit_ErrHandler

End Function


That's it
 
Last edited:

Users who are viewing this thread

Top Bottom