Shortcut Menus & Subforms

G

Guest

Hi,

I am using Macros to create Shortcut Menus. The macros call various VB Code
that I've written. One issue that I'm having is the Shortcut Menus on my
subforms. I have designed my subforms so that they can appear in any number
of spots. This means they do not always have the same
form![myForm]![meSubform] type location address.

This means that if I write a Public Function for my Macros to call, the code
doesn't know where the subform happens to be, so it doesn't know where to
perform the action.

I've tried embedding the code under the form itself, but when I do that, the
Shortcut Menu doesn't seem to be able to see the Function, even if I declare
it as Public.

Is there some way I can write my Functions so that they will work on the
current form or subform no matter the forms location? Better yet, how can I
make my Shortcut Menu see the Function even if it is embedded on the form
itself?

Thanks ahead of time,


Bill
 
G

George Nicholson

How about the ActiveForm or ActiveControl properties? When using subforms,
ActiveForm always refers to the Parent form so it may be of limited use.
However, ActiveControl.Parent might get you a reference to the "current"
subform without having to go through contortions to specify its location.

I haven't tried it myself. Good Luck.

HTH,
George Nicholson

Remove 'Junk' from return address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top