Trying to update a date field with today's date if the record was added or modified

I have a field on a form which is a date field.  I want that date field to be updated to today's date if the record is a new record OR if the record was changed in any way.

I've tried this in the afterupdate and ondirty event but it doesn't work:

me.datefield = Date
Who is Participating?
Your code needs to be in the FORM's BeforeUpdate event.  The form's BeforeUpdate event ALWAYS runs when a record is dirtied (add, change, or delete) and it is the last event to run.

The AfterUpdate event runs AFTER the record is saved and so it is akin to closing the barn door after the horse has escaped.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.