How do I call a sub in one form module from a sub in another form.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with two subforms. A button on the first subform executes a
sub in that subform which opens the second subform. For reasons it is not
necessary to bore one with here, upon completing and saving entries on the
second subform, I would like to "re-open" it by calling, from the second
subform, the sub in the first subform that initially opened the second
subform. I'll slightly bore you by stating that opening the second subform
as I do performs an initialization that only works when I open the second
subform from the first subform. The problem is, when attempting to call or
run the sub in the first subform module from the sub in the second subform
module, I cannot get Access to recognize the sub in the first subform module
.. Help.
 
Rod said:
I have a form with two subforms. A button on the first subform executes a
sub in that subform which opens the second subform. For reasons it is not
necessary to bore one with here, upon completing and saving entries on the
second subform, I would like to "re-open" it by calling, from the second
subform, the sub in the first subform that initially opened the second
subform. I'll slightly bore you by stating that opening the second subform
as I do performs an initialization that only works when I open the second
subform from the first subform. The problem is, when attempting to call or
run the sub in the first subform module from the sub in the second subform
module, I cannot get Access to recognize the sub in the first subform module


This is too convoluted. It is not necessary to (re)open the
second form. (Note: you can not open a subform, so you must
be talking about separate forms.) The (re)initialization of
the second form can be done entirely from within itself by
rearranging the code into an appropriate set of procedures
(even if you need argument values from the first form).

Why don't you tell use what form two is trying to accomplish
and I'll bet someone will be able to help you straighten
this out.

BTW, you can call a PUBLIC procedure in another form by
using the syntax: Forms!otherform.procedurename

Another thouught. If the first form opens the second form
in Dialog mode, the code in the first form is suspended
until the second form is closed (or becomes invisible).
This means the second form only needs to close itself, at
which point the code in the first form resumes and can, if
desired, open the second subform again. But this still
sounds like a little too much cross dependency between the
forms.
 
Back
Top