NanoNet
NanoNet

Reputation: 324

MSAccess: Hiding Navigation Pane, and Menu Bar Using VBAccess

Is there a way to hide the Navigation Pane, and Menu Bar on launch using MSAccess VB? Point is to remove "distractions" from users using MSAccess solution.

Fig A: Hiding the Navigation Pane and Menu Bar

enter image description here

Upvotes: 5

Views: 11397

Answers (2)

Harun24hr
Harun24hr

Reputation: 36770

Personally I use below codes to hide navigation pane & ribbon to my databases. You can also try-

Private Sub Form_Load()
On Error GoTo HarunErrHandler
    
'******************* Hide Ribbon and Navigation Pane ***************************

    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    Call DoCmd.NavigateTo("acNavigationCategoryObjectType")
    Call DoCmd.RunCommand(acCmdWindowHide)

'*******************************************************************************

Exit Sub
HarunErrHandler:
MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbInformation, "Error"
End Sub

If you need to show them again then use below codes.

'******************* Show Ribbon and Navigation Pane ***************************

    DoCmd.ShowToolbar "Ribbon", acToolbarYes
    Call DoCmd.SelectObject(acTable, , True)

'*******************************************************************************

Upvotes: 3

AHeyne
AHeyne

Reputation: 3455

Option 1

One easy way is to rename the *.accdb to *.accdr.

Then it will be opened in runtime mode without ribbon bar and navigation pane.

Option 2

Call the database by full command line of Microsoft Access and the database and the command line parameter /runtime, then it also will be opened in runtime mode.

Example:

"c:\Program Files (x86)\Microsoft Office\Office15\msaccess.exe" "c:\data\yourDatabase.accdb" /runtime

(the path of Microsoft Access varies regarding your installation of Access (msi or c2r, x86 or x64, version of access, custom installation folder...)

Option 3

You can hide them by code:

Upvotes: 7

Related Questions