Events on Forms

madeline

New member
Local time
Tomorrow, 00:01
Joined
Jan 24, 2011
Messages
5
Hi All,

I've got a form where I want a date field to automatically change the date if any of the data on a row is changed or added.

I've found a similar thread before but unfortunately I couldn't get it to work.

Private Sub Form_AfterUpdate()
Me.Last_Updated = Now()

I really don't want the date to change afterupdate, rather I wanted it to change when a user makes a change on the row, but alas I just couldn't get it to work. It certainly doesn't input a date in that field at all. I've tried ondatachange which I thought was more appropriate.

Thank you in advance for any advice :)
 
Your code put in Sub Form_BeforeUpdate.
 
I suspect you want the Default Value of that field to be today's date. If this is the case then go into the Design view of your table and under the Default Value property of that field, put Date()
 
I suspect you want the Default Value of that field to be today's date.
OP wants this "if any of the data on a row is changed or added." Default Value only works on new records, of course. MStef is right, the code simply needs to be moved to the Form_BeforeUpdate event.
 
Last edited:
OP wants this "if any of the data on a row is changed or added." Default Value only works on new records, of course. MStef is right, the code simply needs to be moved to the Form_Update event.
Ah, yes! I missed the "changed" part. Thanks.
 
mmmh thanks for this, but I can't find form_update anywhere :( even in the help files I can't find any reference to this.
 

Users who are viewing this thread

Back
Top Bottom