Disable form menus while allowing control menus

Published on
3,528 Points
3 Endorsements
Last Modified:
You can disable Form and Title shortcut menus without disabling the shortcut menus for other controls

One of the reasons that developers disable form shortcut menus when deploying an application is because of the shortcut menus that pop up when you right click on the form title or the form itself, allow users to do things we, as developers, don't want them to do.  Both the forms Title menu (article image) and the form Form View Popup Menu (below) offer a bunch of options you don't want your users to see.


As part of the work I did to develop the Access Shortcut Tool, I ran across a trick that will allow you to disable the shortcut menus associated with the title bar, and the form itself, without disabling the shortcut menus associated with controls on your form(s).  You might still want to use alternate shortcut menus for some of the controls as well, but by adding two lines of code to your application load and unload processes, you can disable all of the form Title and Form shortcut menus.

Those two lines are:

Commandbars(127).Enabled = false     'This is for the form Title Bar menu

Commandbars(6).Enabled = false          'This is the Form View Popup menu

You only need to run this code once, when you load your application, not for each form.

Technically, you don't need to reverse that when you exit your application because the Enabled property value of those two commandbars does not persist when you close Access.  However, it does persist if you simply close the application where that code is used, and open another Access application.  To be on the safe side, I would encourage you to run that code with Enabled = True when you close your application.

Dale Fye

My Profile

Author:Dale Fye
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free