如何从空白的主窗口开始?
我想编写一些VBA 脚本,以便当我启动访问应用程序时主窗口为空白。这是我需要删除或隐藏的内容列表:
- 整个功能区
- 状态栏
- 导航窗格
- 窗口选项卡
此外,我想在右键单击时禁用弹出菜单。 我还想禁用 SHIFT 旁路键启动。
我基本上希望它看起来像用 VB 或 C# 创建的应用程序。 只有当我以管理员身份登录时,禁用的选项才会被绕过。
I want to write some VBA script so that when I start my access application the main window is blank. This is the list of things I need to be removed or hidden:
- The entire ribbon
- The status bar
- The navigation pane
- The window tabs
In addition, I want to disable the popup menu when right clicking.
I also want to disable SHIFT bypass key startup.
I basically want it to look like an application created with VB or C#.
Only if I login as admin will the disabled options be bypassed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
必须是VBA吗?为什么不使用普通的 Access 应用程序选项?
在 Access 2010 中,您可以通过“文件”>“找到它们”选项>当前数据库。几乎所有你想要的东西都可以取消选中 - 请参阅下面的屏幕截图。您选择的选项将与您的数据库一起保存。
您可以在按住 SHIFT 的同时启动数据库,这将覆盖这些启动选项并显示您的“正常”功能区、状态栏、导航栏...
Does it need to be VBA? Why not using the normal Access Application Options?
In Access 2010 you can find them via File > Options > Current Database. Almost all the things you want can just be unchecked - see the following screenshot. The options you select there are saved with your database.
You can start the database while holding SHIFT which will override these start up options and show you your "normal" ribbon, status bar, navigation bar, ...
在启动功能中尝试以下操作
这应该可以实现您想要的功能
可能与其他 MS Access 窗口元素一起使用,我只是不想显示上面的部分。
Try the following in startup function
This should do what you want
Might work with other MS Access windows elements, I just wanted to not display the parts above.
旧线程但仍然有用的信息。我所做的就是:
将该代码放入从名为
AutoExec
的宏调用的Public Sub
中。禁用窗口选项卡和 Shift 绕过比较棘手,因为这些需要通过设置数据库属性来完成,可以通过数据库
Properties
或使用CreateProperty
附加属性。此外,您需要退出并重新打开数据库才能使这些更改生效。我在 techrepublic 上找到了 的说明 和 Allen Browne 在他的网站上有更完整的说明。
Old thread but still useful information. Here's what I do:
Put that code in a
Public Sub
called from a macro calledAutoExec
.Disabling Window Tabs and the Shift Bypass are trickier because these need to be done by setting the database property, either through the database
Properties
or by appending a property withCreateProperty
. Also, you need to exit and reopen the database for these changes to take effect.I found instructions over on techrepublic and Allen Browne has more complete instructions on his website.
实际上,如前所述,您可以使用启动选项来删除弹出窗口、选项卡等方面的大多数问题。
要隐藏功能区、qat,只需使用:
DoCmd.ShowToolbar "Ribbon", acToolbarNo
因此,使用选项设置正确并且一行代码,您只能看到您的表单。
这是使用上面一行代码和选项来关闭选项卡的结果屏幕截图(您想要选项卡式窗口,但选项卡已关闭)。请注意您如何查看 Windows 桌面。这一切都是通过上面的一行代码完成的:
Actually, as noted, you can use the startup options to remove most all of the questions you have in terms of popups, the tabs etc.
To hide ribbon, qat, just use:
DoCmd.ShowToolbar "Ribbon", acToolbarNo
So, with the options setup correct and ONE line of code, you only see your form.
Here is an resulting screen shot of using the above one line of code and options to turn off tabs (you want tabbed windows, but tabs turned off). Note how you see the windows desktop. this was all done with one line of code as per above: