me.dirty false but still executing form after update code

  • Thread starter Thread starter Abbey Normal
  • Start date Start date
A

Abbey Normal

I am confused about why the code in the Form after update is executing when
Me.dirty is false. What happened is: the user changed a field, then during a
prompt they chose 'cancel' which did an undo. then they advanced to the next
record using the navigation arrow at the bott. That was the only thing done
on the form. I set a breakpoint and confirmed that me.dirty was equal to
false. Can any one set me straight? Thanks--
 
Form_AfterUpate executes *after* a save has succeeded. Consequently, Dirty
is always false in this event (unless you do something in this event that
dirties the record - not a good idea.)

But I think your question is why Form_AfterUpdate is firing at all. If the
record changes are being undone, no changes were saved, and so the event
should not fire. Your understanding is right.

So, if Form_AfterUpdate is firing, it would imply that either the changes
were not undone, or something else if dirtying the form again after that.

a) Is it possible that the undo is applied to a field or control, not to the
form? If something else was also dirty, undoing one control would not
prevent Form_AfterUpdate.

b) If the form is being undone, what else could be dirtying it? Use
Form_BeforeUpdate to find out. Compare the OldValue of the controls to their
Value, and see what changed.
 
yes, that is exactly it. The control itself is being undone, not the form.
And since i am using after_update, it sounds like dirty was already reset by
then. I will change my code to before_update and then I guess i will see the
correct staus of dirty.
Thank you!
 
Just to be clear, Abbey, BeforeUpdate and AfterUpdate events apply both to
controls and forms.

Me refers to the form, so I assumed you were talking about Form_AfterUpdate.

Just in case that clarifies things.
 
Back
Top