How to have a sub form trigger main form code

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

I asked this question in another group a couple days back and no one has
been able to respond yet. Perhaps you can help?

How do I trigger main form code from a sub form's code? I have a routine
that runs on the main form's OnCurrent event. After certain events on the
subform - I need to re-run that code?

The only idea that I had was to place the code in a stand alone module but I
don't like this idea for a couple fo reasons. The best solution in this
case is to simply retrigger the main form's code from the sub form.

Thanks for the help.

Alan
 
Perhaps, no one answered because the sequence of Events in a Form/SubForm
combination is rather complex and you may get to a infinite loop if you call
them incorrectly. For example, do you know that the Open Event of the Form
used as the Subform happens BEFORE the (main) Form_Open Event. Some of the
Events are skipped in the Form/Subform combination also.

You can change the (main) Form_Current Event to a Public Procedure and then
you can call it:

Call Form_MainFormName.Form_Current

but it may get you into strife with an infinite loop or some other problems.

If you have the Access Developer's Handbook by Getz et. al., there is come
code in the Events chapter s that you can see the sequence of events when
you use your Form/Subform combination.
 
Back
Top