I'm trying to disable the right click of the mouse in a form and its not working. I got the Key Preview property set to yes and this code in the On Key Down event:
If Keycode = vbkeyRButton then
Keycode = 0
End If
Am I missing something here?
I'm trying to disable the right click of the mouse in a form and its not working. I got the Key Preview property set to yes and this code in the On Key Down event:
If Keycode = vbkeyRButton then
Keycode = 0
End If
Am I missing something here?
Can i ask as to the reason your trying to disable this ?
Curious, and perhaps there are other ways to accomplish what your doing.
Well long story short, the forms I have do not require a right click. I do already know about the full menus and default shortcut menus in Access Options. However, I have been having some issues with the right click in the ribbon area when in print preview. Right now, I have all my forms in modal format. This prevents the user from getting access to anything outside of the window, including the ribbon. On some of these forms I have a print preview button. This is where my security is weakened because when the user enters the print preview mode it opens up a new screen that is no longer in modal mode and now the user can just right click the ribbon area and select the option to customize quick access toolbar then unhide everything in the database. So I thought I'd try to disable the right click to see if that would work but something tells me it probably won't since the print preview seems to be foreign from anything that you can control in Access. I hate print preview for this but I need it because its good to see what your print out is going to look like before you confirm your print.
You can disable almost anything in access.
Open up the options in the database and select adjust ribbon.
There you can select what you want into the ribbon.
In my case all users can do is undo and redo..
Examine the MouseDown Event from access VBA help. There are button events, perhaps it may help you
Yes but will access ribbon adjust take care of the right click? Remember, when you right click, you get the option to customize quick access toolbar. From there users can change almost everything.
Trevor, thanks. I'll look in to that too.
Go to File -> Options -> Current Database -> (Ribbon And Toolbar Option) Uncheck Allow Default Shortcut Menus
If you can trap the mouse button event you can change the outcome...
Xipooo,
I already know about that option. That will just get rid of the right click within forms. Try testing it yourself. Right click on a tab or in the same area where the tabs are and you will see that it will give you the option to customize quick access toolbar even when Allow Default Shortcut Menus is unchecked.
Ok then, so outside the box, perhaps disable the mouse button in windows, or a 3rd party app. I'm sure that you can set both buttons to left, right or whaever. I use xmouse button control v1.5 enables control of all mouse buttons/wheels for multiple programs.
JeroenMioch,
Its called customizing the ribbon. I am not really trying to customize it. I am trying to somehow get rid of the option to customize quick access toolbar. The way it works is if the user right clicks the home tab or anything in that area of the ribbon, the user will get a menu of options. In this menu is an option called Customize Quick Access Toolbar. If the user selects this option they will now have access to all the things that I have hidden. Try it yourself and you will see what I am talking about. This is a hole in the security system that I have created and I believe once this is solved, my database and everyone else's database will be so much better in preventing the user from screwing up the database.
Does anyone not know how to fix this? Please give it a try with the right clicking of the ribbon area so you know what I am talking about. Right click a tab such as Home or near one of the tabs then select the Customize Quick Access Toolbar. Then go to Current Database. There you will see the user can undo everything you did.
P.S. this is the site for xmouse s/w, it's free with forums and support.
http://www.highrez.co.uk/
Hey trevor40,
thanks but I can't use 3rd party software. This is for work and they wouldn't allow me to do that. Thanks for the suggestion though.
I also tried messing with the On Mouse Down event but was not able to get it to disable the right click of the mouse. Here is the code I used:
If KeyCode = vbkeyRButton Then
KeyCode = 0
End If
I think even if it did work, it probably wouldn't work for what I want it to do. It would only probably work for that specific form that I apply this code to. I need it to work when all windows are closed too. I got all my forms in modal windows so it works nicely except for when I do a print preview. Then it goes outside of the modal mode and then the user can just right click the ribbon area and get access to the options to unhide everything.
So my journey continues to find an answer. I just can't believe this seems like such an easy thing to fix when really its turning out to be a nightmare.
Are you using a customised ribbon for user interface? If not, I would suggest you to create your own ribbon so that users will not be able to customise the QAT.
The only other thing I can think of is dissable the menus, see this forum link
https://www.accessforums.net/access/...0-a-41804.html
It's for access 2003 so will need to be modified by you to do this with the 'ribbon' if it works for you.
And as amrut above says, add your own menu and limit the options, but as in the post above create some way to reverse or restore the menus via password, or a restore menus db.