Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling right mouse click in forms

Status
Not open for further replies.

jjames07

Programmer
Joined
Jul 3, 2004
Messages
3
Location
GB
I've been developing a program through Microsoft Access (with VBA coding) for my A level course, and the organisation I based it on are interested in using it. To finish it off, I want to disable the right mouse click in all forms. I thought u might be able to do it through VBA coding using "On mouse down" or simply using 'On current'.
The idea came from a website "HSBC" (banking), when you right clicked within the site a message would appear 'This function is not allowed' or somthing allong those lines.
I would be greatful for a solution to this problem.
Yours truly,
Johnathan
 
take a look at this code from the MS Access help:

Code:
Private Sub Form_MouseDown(Button As Integer, _
         Shift As Integer, X As Single, _
         Y As Single)
    If Button = acLeftButton Then
        MsgBox "You pressed the left button."
    End If
    If Button = acRightButton Then
        MsgBox "You pressed the right button."
    End If
    If Button = acMiddleButton Then
        MsgBox "You pressed the middle button."
    End If
End Sub

HTH,
fly

[blue]Typos, that don't affect the functionality of code, will not be corrected.[/blue]

Martin Serra Jr.
 
Thats a good start, but it doesnt disable the right mouse menu, is there a way to do this?
Cheers for that bit of code!
Johnathan
 
Take a look at the DoCmd.CancelEvent method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I tryed what you've said, but I noticed it only applyes to objects (such as message boxes...) but i was just messing about for a couple of seconds in the properties of the form and came accross "Shortcut Menu". By changing this from Yes to No, it didn't display the menu by right mouse clicking!! So I cracked it!!
Cheers for all your help, and I will use some of the information (the msgboxes etc)
Johnathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top