Right Click - Shortcut Menus

My Client uses the right click option on all his forms (about 14) to bring up the popup that allows him to select a specific record.Popup.docx See attached copy of popup.docx. This popup appears if the user right clicks in a specific field.
The right click also allows the user to go into the forms design view which is a security risk. (If the right click is not on a specific field)
I have deactivated the right click option in the MS Access Option option when the 'File' option is selected and then "Current Database" and then un-click  the "Allow Default Shortcut Menus". This however deactivates the popup to do the filter bit.

Is there anyway that I can deactivate the right click mouse button, but allow the popup to do the filter bit.

Any assistance would be appreciated
Anton GreffrathAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
you can create your own right-click menus, not nearly as easy as it was in A2003 and earlier, but still possible.

I've got a series of articles on creating and modifying right-click (shortcut) menus located:
Understanding and Using Commandbars (Shortcut menus) Part I
Understanding and using CommandBars, Part II (Creating your own)
CommandBars (Part III) - Using Built-in Shortcut Menus  <=  this is the most applicable one for you.
Using Shortcut (right-click) menus in the Access runtime environment
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Let me suggest you get Dale's Access Shortcut Tool, which is something I use weekly and without which, well ... it would be painful at best to continue to develop Custom right click shortcut menus ... since the original Customize tool was removed in A2007.  I helped Dale beta test this tool for almost a year, wherein many cool features were added that were not present in the original Microsoft Customize tool.  No need to mess with code when this super cool and extremely useful tool exists!

Highly Recommended ....
0
Anton GreffrathAuthor Commented:
Comment for Dale Fye:

Thanks for the information in the articles you recommended. My requirement is to turn off some of the 'Right Click'/Shortcut/CommandBars' that exist on the Form object in MS Access 2013/2016 and I am sure that your recommended article (CommandBars (Part III) - Using Built-in Shortcut Menus) will do the trick

I did include the suggested code to assist in identifying the names of the PopUp menus in my Application but when I run it (F8) i get the error 'User Defined type not defined'. This is for the command: 'Dim cbr as CommandBar' I presume the same will happen with the command: Dim btncbr as CommandBarButton

Am I overlooking something?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dale FyeOwner, Developing Solutions LLCCommented:
Check to make sure you have the Microsoft Office #.0 Object Library (where # represents the current version of Office you are using) listed as a reference in your application.

After you have the code working, you can change your declarations to:

dim cbr as Object
dim btn as Object

and remove the reference, but for your initial work, you need that library referenced.  Plus this will give you intellisense.

HTH
Dale
0
Anton GreffrathAuthor Commented:
Comment for Dale Fye:

I got the code to execute successfully, but when I click on the 'What's This' option on the popup I get a Run time error 424, Object require in the code line marked with an X

Public Sub WhatsThis()
Dim cbr As Object
Dim btn As Object

On Error GoTo ProcError

For Each cbr In Application.CommandBars

    Set btn = cbr.Controls.Add(1, , , , True)
    btn.Caption = "What's This"
    btn.onaction = "WhatsThisMenu"
    btn.begingroup = True
   
NextBar:
Next

ProcExit:
    On Error Resume Next
    Set btn = Nothing
    Set cbr = Nothing
   
ProcError:
    Resume NextBar
   
End Sub

Public Sub WhatsThisMenu()

   Debug.Print "Name:  "; CommmandBars.ActionControl.Parent.Name   XXXXXXXXXXX Object required
    Debug.Print "index: "; CommandBars.ActionControl.Parent.Index
    MsgBox "Name : " & CommandBars.ActionControl.Parent.Name & vbCrLf _
    & "Index: " & CommandBars.ActionControl.Parent.Index

End Sub

I rechecked the code but cannot fine the problem. Can you please assist?
0
Dale FyeOwner, Developing Solutions LLCCommented:
I'm not sure what is going on there.  Take a look at the attached database, it has the latest version of this code that is in my Shortcut Tool.

Run the "dfcbt_WhatsThisMenuAdd" code when you open the database.  Then right click on any object in the database and check it out.

You can run the "dfcbt_WhatsThisMenuRemove" procedure to remove the "What's This Menu" item from each of the commandbars, but you don't really need to, they will disappear when you close access because of the "True" value entered in the "Temporary" argument of the .Add method.

WhatsThisMenu.accdb
0
Anton GreffrathAuthor Commented:
Comment to Dale Fye:

I obtained most of the info I require from your documentation, however there is one specific bit of info that I cannot find. My objective is to 'disable'/'hide' one specific option on a specific popup on a form. The popup name is "Form View Popup" and it appears when you click anywhere on (any) form. outside any control. See Attached Form-View-Popup.docx

On this Popup I want disable the option "Design View". My question is: How do I get access to the controls at this level. i.e. "Form View", "Layout View" "Design View" etc.

Your document "CommandBars (Part iii) Section C (A third Method to hide controls. . . .) describes how to hide/reveal all the built-in controls in a shortcut menu in one step but not how to hide/reveal only one of these built in controls.

Your assistance is appreciated.
0
Dale FyeOwner, Developing Solutions LLCCommented:
Anton,

Sorry for the delay in response; this thread somehow slipped off my radar.

When I have built-in menus that I want to alter (do this with great caution because the changes are not just for the current database), I put code in the Open events of my Splash form that looks something like:

Commandbars("MenuName").Controls("ControlName").visible = false

After the user logs in, or the splash form is done it calls my main form and hides the Splash form.  When the Main form is closed, it closes the Splash form, and the Close event of the Splash form has a line which makes that control visible again.

Commandbars("MenuName").Controls("ControlName").visible = True
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.