Custom Right click menus

  • Thread starter Thread starter SJ
  • Start date Start date
S

SJ

Is it possible to create right click menus for Access, so that one could
use them say, on a right click in a text box to perform various custom
functions.

thx
 
Hi SJ,

I've never done it, but Access Help seems to indicate that it is possible.
Open a form in design view. Click on View > Properties to display the
Properties dialog, if it is not already displayed. Select the text box in
question. You should see the name of the text box in the title bar of the
Properties dialog. Select the Other tab. Click into the Shortcut Menu Bar
property. Press the F1 key to open context sensitive help on this property.
In Access 2002, I see the following:

ShortcutMenuBar Property
You can use the ShortcutMenuBar property to specify the shortcut menu that
will appear when you right-click on a form, report, or control on a form.
Read/write String.



Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
SJ,

Yes, I used them a lot.

1. Right-click the menu bar, and select Customize. The Customize dialog box
is displayed.
2. Click New. The New Toolbar dialog is displayed.
3. Enter a name for your context menu, and click OK. A commandbar is
displayed.
4. Select the Commands tab.
5. Drag the Custom command onto the new commandbar, or alternatively, drag
an existing command onto it.
6. Right-click the custom commandbar you just created, and change the Name
property to something meaningful. This will be the first item on the context
menu.
7. Add, copy & modify, or create an image for the item.
8. Select the style you want for the item (Default Style, Text Only, Text
Only in Menus, or Image and Text). I usually use Image and Text.
9. Select Properties. The control's Properties dialog is displayed.
10. In the OnAction property, enter the name of the function to execute when
the user selects the item. This has to be in the format =MyFunction().
11. Give it a screen tip, if you wish.
12. Click Close.
13. When you've finished adding and modifying commandbar items, select the
Toolbars tab.
14. If your commandbar isn't selected, select it and click Properties. The
Toolbar Properties dialog is displayed.
15. Select Popup from the Type combo, and click OK to the subsequent message
box.
16. Click Close. You have just created a context menu.

To get at the design for your contect menu:
1. Right-click the menu bar, and select Customize. The Customize dialog box
is displayed.
2. Tick Shortcut Menus in the Toolbars list. The shortcut Menus are
displayed (usually at the top of the screen).
3. Select Custom. You'll see your new context menu there.

You'll have to write a public function to handle each menu item's Action
event.

To attach your new context menu to a control:
1. Open up your form, and select the control that will use this context
menu.
2. Display the Properties dialog.
3. Select the Other tab.
4. Select your menu from the Shortcut Menu Bar drop-down.

That's it! Enjoy!

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
Back
Top