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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right click 3

Status
Not open for further replies.

merlin72

Programmer
Apr 18, 2000
50
US
I would like to open a from when i right click on text box. The same way when you right click on windows desktop. I'm stuck @ the moment on this not knowing which way to go.
Regards
Jim.


 
No prob!
Try this in the text box MouseDown event:

DoCmd.OpenForm ("Name of my form")
DoCmd.CancelEvent

(The CancelEvent prevents the normal right-click menu from popping up)
 
The solution provided by CaptainRon does work, but it also opens the form when the left button is clicked. I also encountered the shortcut menu opening with grayed if I ran the right click event two times in succession. So you might consider using the following code which disables the Form's shortcut menu when the right mouse button is clicked and opens the form in Dialog mode, then uses the Detail's MouseMove event to turn the shortcut menu back on.

Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.ShortcutMenu = True
End Sub

Private Sub TextBoxName_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = acRightButton Then
Me.ShortcutMenu = False
DoCmd.OpenForm "FormName", , , , , acDialog
End If
End Sub

PaulF
 
In Access go to "View" - "Toolbars" - "Custom" create a menu and name it what ever. Go to it's properties and make it a "PopUp" and it will add it to your Shortcut menus.

Now go to "View" - "Toolbars" - "Shortcut Menu bar" a menu bar will appear and on the right you will see "Custom" select that and you should see your newly created Popup, now add macros, menu items etc. (What ever you want)

Now select the text box or what ever you want the popup to attach to, go to its "Properties" select "Shortcut Menu Bar" choose your new menu and you are off and running.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top