MS Access 2010: How to startup with a blank main window

我与影子孤独终老i 提交于 2020-01-02 09:54:27

问题


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.


回答1:


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:




回答2:


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, ...




回答3:


Old thread but still useful information. Here's what I do:

DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Status Bar", acToolbarNo
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide

Put that code in a Public Sub called from a macro called AutoExec.

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 with CreateProperty. 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.




回答4:


Try the following in startup function

This should do what you want

DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Status Bar", acToolbarNo

Might work with other MS Access windows elements, I just wanted to not display the parts above.



来源:https://stackoverflow.com/questions/3872649/ms-access-2010-how-to-startup-with-a-blank-main-window

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