event on closing a subform

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

I want to activate code when the user exits a form that
contains a subform. I have tried several events inluding,
onclose, afterupdate, onunload, lostfocus, etc....all not
working. The variables that determine the results of code
execution are set when fields on the subform are updated.
I.e., AfterUpdate(Field1) myvar = "True".... Can anyone
help me execute this code when the subform is closed? Or,
can I not do it, and does the close event have to be on
the "mother" form? If it has to be on the "mother" form,
then how do I pass the values of the variables established
on the subform to the code for the close "mother" form
event?
 
Hi,


In the Form used as subform Close event,

-either do the job there,
-either CALL a public subroutine in the main parent form, or in a
common module,
-either (harder, require more know how and time to write code,
harder to debug all possible scenarii) try to build a solution so you can
raise an event, still from the Close event, but send to the parent form.
Consider that only if the sub-form form can be re-used somewhere else in a
context where the event would be then meaningless and/or optional;
otherwise, proceed with one of the first two methods (they are also faster,
technically).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top