Full Version: Change Date On Update
UtterAccess Forums > Microsoft® Access > Access Forms
I have a question regarding updating a form. I have a field in a table that says "lastupdated" and its meant to change to the current date & time when an entry is changed.
Now I use this all the time when I have buttons like on click submit update tbl.lastupdated = now() or something along those lines.
How would I make it so that (in a form where the only buttons are the navigation buttons on the bottom) the field updates to the current time whenever a field is edited in that form?
Thanks UA sad.gif
there are several different approaches to this. As it sounds that your form is bound you can either use the form's dirty event...or the form's before update event in combination with the OldValue property to check if controls have changed their value. A further evaluation within those events would be if the current record is a new record or not.
Good luck
thanx for the prompt reply, worked like a charm uarulez2.gif
You're welcome.
Good luck on future projects!
lol all day I had the freakazoid theme song stuck in my head... I was trying to figure out why of all things I thought of it and then it hit me grin.gif
Hi Centity,
I'm new to MS Access. I'm trying to create a last modified field on my form and display the date and time after any changes occur to the form. It seems like what I'm looking for is similar, if not exactly the same as what you've done. Can you please walk me through your steps?
thanks in advance.
Hey Jhoang. Welcome to UA
Sorry I didn't get back earlier, i did not see your post.
But if you still need help try entering the following code in your form
Private Sub Form_Dirty(Cancel As Integer)
yourtextbox.Value = Now()
end sub
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.