How do I hide the Menu Bar in my Access 2016 Database and only display running forms

核能气质少年 提交于 2021-02-08 11:10:40

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!