Timestamping changed records

dancarter

Registered User.
Local time
Today, 23:23
Joined
Aug 24, 2006
Messages
10
Hi,
I'm trying to populate a read-only field on a form with the time and date the record was last changed.
This is to acheive seeing a list of records that have been updated this week for example.
I have this at the moment:-

Private Sub Form_AfterUpdate()
Last_Updated.Value = Now()
End Sub

When I've updated a record it won't save and when I try to move onto the next record it does nothing, the button clicks but no response.
Does anybody have any idea where I'm going wrong or have any suggestions?

Would appreciate any help.
Thanks,
Dan
 
If you set the date in the afterupdate event the changes are already written to the DB. Validation and setting the datestamp should be done in the beforeupdate event of the form.
 
PeterF said:
If you set the date in the afterupdate event the changes are already written to the DB. Validation and setting the datestamp should be done in the beforeupdate event of the form.

Thanks, but if I try this in BeforeUpdate then I get the error:-
Procedure declaration does not match description of event or procedure having the same name

Any suggestions would be received greatfully?
Thanks
 
dancarter said:
Thanks, but if I try this in BeforeUpdate then I get the error:-
Procedure declaration does not match description of event or procedure having the same name

Any suggestions would be received greatfully?
Thanks

I did miss it the first time but after trying it for myself, the working code is shown below, changes are bold.

Code:
Private Sub Form_BeforeUpdate([B]Cancel As Integer[/B])
Last_Updated.Value = Now()
End Sub
 

Users who are viewing this thread

Back
Top Bottom