开发者

How to start with a blank main window?

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 b开发者_如何学运维e bypassed.


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

How to start with a blank main window?


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.


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.


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:

How to start with a blank main window?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜