Call a marco on another form ?

S

SpookiePower

I have two forms - a mainform with a subform on it.

Most of my code are on the main form, but I have startede to wirte
some code on the subform. In the code on the subform I need to call
some code from my main form. How can I do that ?
I can remember from my old Delphi Pascal days, that you must include
units to get access to code from other places, but how can I do it here
??



www.photo.activewebsite.dk
 
T

tina

are you using macros? or VBA code? macros are not saved as part of a form or
report, they're separate objects. to run any macro, just select the macro
name from the droplist of the event, in the Properties box.

hth
 
T

tina

well, i've done it in VBA, but only once or twice, so i'd have to fiddle
around 'til i figured it out again, and i couldn't vouch that anything i
posted would be the "right" way to do it. suggest you hang with this thread
for awhile; if you don't get an answer by tomorrow, then suggest you re-post
the question in the
microsoft.public.access.modulesdaovba
newsgroup. don't use the word "macro" though; since macros and VBA code are
two different things in Access, you'll just confuse people! :)

hth
 
K

Ken Snell \(MVP\)

So long as the other form is open, and you've declared the VBA procedure in
that form "Public", you reference it by this syntax:

Form_NameOfTheForm.NameOfTheVBAProcedure
 
K

Ken Snell \(MVP\)

Yes, the form's module is "accessible" only when the form itself is open.
 

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