By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,695 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,695 IT Pros & Developers. It's quick & easy.

How to disable "Right Click"?

P: 53
Hello all
I have a new problem with my application.
I want users of my application be disable to entering in design view of a Form by right clicking on the forms and selecting Design View.
If there is any way to disabling Mouse right click at Run time with VBA please aware me.
Thanks in advanced
Jul 22 '10 #1
Share this Question
Share on Google+
11 Replies


NeoPa
Expert Mod 15k+
P: 31,769
I know of no way to intercept or disable right-clicks per se, but a database password would ensure it wouldn't open without the password.
Jul 22 '10 #2

100+
P: 374
Can you not just create a MDE?

Alternatively take a look at:

** Edit **
Removed illegal link to competing forum.
Jul 22 '10 #3

P: 53
@NeoPa
It's Bad news
Jul 22 '10 #4

NeoPa
Expert Mod 15k+
P: 31,769
It's not all bad. Consider Munkee's suggestion of an MDE for distribution (or ACCDE I believe for Access 2007 and beyond). I would expect this to be perfect for you.
Jul 22 '10 #5

missinglinq
Expert 2.5K+
P: 3,532
I believe you can customize the Short Cut Menu to remove the Design View option. In Form Design View invoke Access Help and enter the phrase "shortcut menu" then select "Customize a shortcut menu" and follow the Yellow Brick Road!

Linq ;0)>
Jul 22 '10 #6

100+
P: 374
Sorry about the link NeoPa.

There are plenty of options still for you alinagoo. If you choose to move to mde (prior to 2007 as NeoPa pointed out). The mde would stop accidental design changes and as long as you also keep a backup version of the original MDB file you can make any future changes in that file and then just recreate a new mde for distribution.

You could also take a look at creating your own user login system the basic idea would invovle a user logging in, their permissions stored within a table. Upon every Form_Open event you would check their permission, if they do not have the rights to view then you can just do a cancel = true and display some message. This route can also allow you to manage views so allowing certain users only read access, others add/edit etc. In both cases you can also turn shortcut menu = off which would get rid of the menu right click I believe.

Edit: Seems missingling suggested the short cut menu whilst I was typing up this post =]
Jul 22 '10 #7

missinglinq
Expert 2.5K+
P: 3,532
And last, but not least, you could always use the SMMM (Sister Mary Margaret Method) that involves the application of a heavy steel-edged ruler to the hand of anyone monkeying with your form design! If you're not familiar with this method, any associate who attended Catholic schools will be able to explain it to you!

The truth is that you're obviously talking about a multi-user database here, which means that the app should be split in a front end/back end configuration, with the forms residing in the front end, a copy of which should be on each user's hard drive. If they do go in and monkey with the design, it will only be effecting their copy of the form, and sooner or later they'll probably scrootch the pooch and require help, and you'll know that they diddled with it when they shouldn't have!

This problem was brought up in a class I helped give a while back and it was suggested to the small company owner who raised the question that he simply tell his employees that modifying a database without authorization was tantamount to destroying company property and anyone caught doing so would be immediately terminated. He followed this advice and reported 6 weeks later, on the last day of class, that the problem had been totally resolved!

Linq ;0)>
Jul 22 '10 #8

P: 4
I publish our monthly MIS database to users on a bi-weekly basis. I keep a master copy as a backup, so I am not concerned of users messing up the database.

In Access 2007 (or most of previous Access), you can disable right-click by going to design mode of the form and under "Other" tab, change the "Shortcut Menu" to No. The problem may arise if users need to sort data using the right-click button. The other potential problem is Access 2007 always have the ribbons enabled. The old method of creating your own menu no longer exists. And ribbons by default have the "Design" button enabled.
Jul 22 '10 #9

P: 53
@CoolC401
Thanks all
I liked to disabling Right-Click by VBA automatically not manually by manipulating menus!
Best Regards
Jul 24 '10 #10

100+
P: 374
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Public Sub DisableMenu()
  4.  
  5. Dim obj As AccessObject
  6. Dim db As Object
  7. Set db = Application.CurrentProject
  8.  
  9.  
  10. For Each obj In db.AllForms
  11. DoCmd.OpenForm obj.Name, acDesign
  12. If Forms(obj.Name).AllowDesignChanges = True Then
  13. Forms(obj.Name).ShortcutMenu = False
  14. End If
  15. DoCmd.Close acForm, obj.Name, acSaveYes
  16. Next obj
  17. End Sub
If the sheer number of times to keep setting the shortcut menu off is becoming the hassle then you can always just loop through each form disabling it.

Give this a go, place it in a module and run from there. Any sheets you do not wish to disable change the forms allowsdesignchanges to false. You could also manipulate this to just be set on form open etc to disable the right click.
Jul 24 '10 #11

NeoPa
Expert Mod 15k+
P: 31,769
alinagoo: I liked to disabling Right-Click by VBA automatically not manually by manipulating menus!
Have you tried Linq's suggestion from post #6? Surely that effects the whole database, and you need only do it once.
Jul 24 '10 #12

Post your reply

Sign in to post your reply or Sign up for a free account.