run code from outside module

J

jeanne

I have several forms, each which have a button that
performs some data updates and calculations in private
sub procedures.

I would like to be able to "batch" run all these
procudures code from a button on another form. Can this
be done?
 
D

Dirk Goldgar

jeanne said:
I have several forms, each which have a button that
performs some data updates and calculations in private
sub procedures.

I would like to be able to "batch" run all these
procudures code from a button on another form. Can this
be done?

Only if the procedures are changed from Private to Public, and the forms
are open at the time. If these conditions are met, then you can call
each procedure by prefixing it with a reference to the open form
containing it; e.g.,

Call Forms!MyForm1.cmdDoThis_Click
Call Forms!MyForm2.cmdDoThat_Click
' ...

Are these procedures that don't actually require the forms to be open?
If so, you could move the meat of the procedures into a standard module
and just call them from the command buttons on the forms, and also call
them from this other "batch" form without needing the original forms to
be open.
 
C

Chris Nebinger

I would move each routine to a standard module. Then have
the form call the module in question.


Your batch button would call them in sequence.


Chris Nebinger
 
G

Guest

Thank you! That did it.
-----Original Message-----


Only if the procedures are changed from Private to Public, and the forms
are open at the time. If these conditions are met, then you can call
each procedure by prefixing it with a reference to the open form
containing it; e.g.,

Call Forms!MyForm1.cmdDoThis_Click
Call Forms!MyForm2.cmdDoThat_Click
' ...

Are these procedures that don't actually require the forms to be open?
If so, you could move the meat of the procedures into a standard module
and just call them from the command buttons on the forms, and also call
them from this other "batch" form without needing the original forms to
be open.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 

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