Solved

Custom short cut menu

Posted on 2014-02-06
6
301 Views
Last Modified: 2014-04-22
I have a maximized form that is in a databsheet view.  I want the user to be able to close the form because the tabs are not showing. How can I make it so that if the user clicks on the right mouse button there is only one option: Close?  Thanks.
0
Comment
Question by:Sasha42
  • 3
  • 2
6 Comments
 
LVL 84
ID: 39840726
What version of Access are you using? Versions before 2007 made it quite simple to create a right-click menu, but 2007 or newer is quite different.
0
 

Author Comment

by:Sasha42
ID: 39895984
I am using 2007.  Thanks for your help.
0
 
LVL 84
ID: 39897039
Essentially you create a custom macro group that includes the commands you want the user to see, and then you "call" that macro in the Form's "Shortcut Menu" property. This will supplant the default Access right click menu, and you can include only those items you want the user to see.

See this article for more information:

http://office.microsoft.com/en-us/access-help/create-custom-menus-and-shortcut-menus-by-using-macros-HA010282509.aspx
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 75
ID: 39897570
fwiw ... a new tool (Access Add In) is being developed as we speak that will replace the <=A2003 Customize Dialog. It will allow creating new commandbars (menus & right click  menus) as well as edit existing commandbars. It will also have several features not present in the original Customize Dialog, including importing selected commandbar elements from other dbs.

No coding will be required ...

mx
0
 

Author Comment

by:Sasha42
ID: 39898829
Can you show me what the vba code would look like?  I use code instead of macros. Thanks!
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39899071
Essentially you do this:

strCBarName = "MyNewPopupMenu"
Set cbrCmdBar = Application.CommandBars _
   .Add(Name:=strCBarName, Position:=msoBarPopup)

From here: http://msdn.microsoft.com/en-us/library/office/aa140930(v=office.10).aspx

Once you do that, you can then set the form's Shortcut menu to whatever you've named the popup.

Obviously you'd want to add items to that. The article here shows how to do that:

http://msdn.microsoft.com/en-us/library/office/aa163587(v=office.10).aspx

Note too the links on those pages in the "See Also" section - there are a LOT of links that show how to do various things with commandbars.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question