Context Menu in Datasheet

gray

Registered User.
Local time
Today, 06:37
Joined
Mar 19, 2007
Messages
578
Hi All

I want to add an item to the Context Menu which appears when right-clicking a control in an Access Form when that form is in Datasheet View (a Main Form). When the new item is selected I want to run some VBA code. I'd like to do this so it's compatible with Access 2000 onwards?

I've read tons of threads on this but I'm getting confused... most of the threads talk about adding and/or customising "menu bars" or the ribbon as opposed to context menus?

I've attached a jpg illustrating the menu I wish to add my own item to...

Can anyone help please?
 

Attachments

  • Datasheet Context Menu1.jpg
    Datasheet Context Menu1.jpg
    96 KB · Views: 529
Looks like Access 2007.

There's no GUI for creating context menus in 2007. You can however use an older version to create the GUI and it would transfer over. Downside is you must convert to the older version before you can create the context menus.

Saying that if you want to add to an existing menu you must know the name. Yes you can loop through the CommandBars() collection to get all 150+ commandbars/menubars/toolbars/context menus and test for Type but you can't be sure which one of the context menus is the one you're after.

Bottom line is you create your own context menus. In 2007 you do it in code:

http://www.accessribbon.de/en/index.php?Access_-_Ribbons:Menus___Toolbars:Toolbars
 
Hi Vba1net

Thanks for the link...it actually makes sense!

I'd be happy to convert mine back to Access2002 as that's where I started to develop my Db... Do you know of any similarly succinct instructions for editing the context menu in 2002 ?

thanks
 
It's just the same way you create toolbars, drag and drop sort of thing. Then you need to change the type to the right type. Plus you also need to attach a macro that runs a function to that menu. I don't have any links for this but you might find something on the net.
 
Thanks VBA1NET and BOB...

and Bob... all I can say is... fantastic tutorial!!

cheers
 

Users who are viewing this thread

Back
Top Bottom