如何隐藏 Access 2016 数据库中的菜单栏并仅显示正在运行的表单 [英] How do I hide the Menu Bar in my Access 2016 Database and only display running forms

查看:45
本文介绍了如何隐藏 Access 2016 数据库中的菜单栏并仅显示正在运行的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试去掉 MS Access 2016 数据库上的菜单栏,并且只有在打开数据库时用户才能看到和使用正在运行的表单.请看下图:

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:

使用菜单栏访问数据库

我该怎么做?

推荐答案

以下代码将隐藏功能区(菜单栏).

The following code will hide ribbon (menu bar).

    DoCmd.ShowToolbar "Ribbon", acToolbarNo

在启动表单Load 事件上编写以上代码.您还可以通过调用以下行来隐藏 Navigation Pane(显示表格、表单、报告等的左栏)

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"

这篇关于如何隐藏 Access 2016 数据库中的菜单栏并仅显示正在运行的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆