Update date when record is revised

G

Guest

I would like to update the date field on a record whenever that record is
modified. I've tried the following code which I got from MS Help without
success. I've installed this code in the Before Update property of the
date/time field.

On Error GoTo BeforeUpdateErr

'Set bound control to system date.
DateModified = Date

BeforeUpdate_End:

Exit Sub

BeforeUpdate_Err
MsgBox Err.Description, vbCritical & vbOKOnly,_
"Error Number" & Err.Number & "Occurred"
Resome BeforeUpdate_End
 
G

Guest

It really should go in the Before Update event of the form, not the control.
You said you want a date when the record is updated, but what you are trying
would update the date even if a user only viewed the record.

Assuming DateModified is a control on your form (can't tell because you
don't use good naming conventions), It should be:

Me.DateModified = Date
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top