AfterUpdate for ALL Fields?

P

PK

Please help!

I have a form that has dozens of fields of various control types (text,
checkbox, drop down, list box, etc). I need to run a piece of code if ANY
field changes value (regardless of type). I COULD set up an afterupdate
event for each field on the form, but that would be a lot of work and be
really ugly.

Any ideas?

Thanks!
 
O

Ofer Cohen

You can use the Form Before Update event to check if there were changes to
the record

If Me.Dirty Then ' Record has changed


Note: if you change a field value and then you chane it back to the original
value t will still act like the record has changed

You can also check each field separatly if the value changed on the same
event.

If me.FieldName <> me.FieldName.OldValue Then ' value has changed
 
R

Rick Brandt

PK said:
Thanks Ofer!

I think this may work...

You actually don;t need to test the Dirty property. If the BeforeUpdate event
of the form is called then by definition, at least one field has been changed.
 
Top