Dirty subform on form close

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

Guest

How do you check for a dirty record on a subform from a form? In the form's
close event, I want to use "If Me.Dirty Then" but the "Me" needs to refer to
the subform's record. Any ideas?

Thanks,
Melanie
 
Melanie said:
How do you check for a dirty record on a subform from a form? In the form's
close event, I want to use "If Me.Dirty Then" but the "Me" needs to refer to
the subform's record. Any ideas?


Not a meaningful thing to do.

The subfrom record was saved (no longer dirty) before the
focus shifted to the main form button.
 
I am having the same trouble as Melanie. By reading other posts I now
understand that by moving control from the subform to the main form that
records on the subform are saved automatically. Actually I have two subforms
on a main form and I want to know when the user tries to close the main form
if any of the subforms have been changed so that I can do some code logic
that takes a while to run. If no changes have been made then I do not want
to waste the users time by running the code.

As of now I run the code either way to be safe, but it is not optimum.
Maybe I need a global variable or something like that. Any ideas?

Chace
 
Add an unbound control to the main form and set its visible property to No.
In the Load event of the form, set the control to false. In the AfterUpdate
event of each subform, set the control to True. In the form's Unload event,
check the value of the control and run your code if its value is True.
 
Back
Top