问题
I'm trying to get rid of the menu bar on my MS Access 2016 database, and only have the user able to see and use the running forms when the database is opened. Please see the picture below:
Access Database with Menu bar
How to I go about this?
回答1:
The following code will hide ribbon (menu bar).
DoCmd.ShowToolbar "Ribbon", acToolbarNo
Write above code on Startup form Load
event.
You can also hide Navigation Pane
(Left bar showing tables, forms, reports etc) by calling following lines
Call DoCmd.NavigateTo("acNavigationCategoryObjectType")
Call DoCmd.RunCommand(acCmdWindowHide)
So, the full code with error handling
will be
On Error GoTo ErrHandler
'Hide ribbon of access window
DoCmd.ShowToolbar "Ribbon", acToolbarNo
'select the navigation pange
Call DoCmd.NavigateTo("acNavigationCategoryObjectType")
'hide the selected object
Call DoCmd.RunCommand(acCmdWindowHide)
Exit Sub
ErrHandler:
MsgBox Err.Description, vbCritical, "Error"
来源:https://stackoverflow.com/questions/41213223/how-do-i-hide-the-menu-bar-in-my-access-2016-database-and-only-display-running-f