Date/Time Updater

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello,

I wanted to make an automated date/time recorder. So whenever the user
makes changes to a specific record it record the time and date when done.

Thanks
 
Lee said:
hello,

I wanted to make an automated date/time recorder. So whenever the
user makes changes to a specific record it record the time and date
when done.

Thanks

Do you want a complete history of when the changes were made and what
they were, or just when or just the date and time of the last change?

The NOW() function can be used to store the latest change to a new field
in the table. You normally would force the users to make changes via a form
and use the on update event as trigger.
 
if you just want a field in the record to show the *most recent* date/time
that the record was edited, then just add a field to the table with
Date/Time data type. make sure the field is included in the form's
RecordSource. in the form's BeforeUpdate event procedure, add a line of code
to set the current date/time, as

Me!DateTimeFieldName = Now

substitute the correct name of the date/time field, of course.

hth
 
Hi Lee,

Do you want to track all changes or just the last change? If just the last
change, here's some code to put in the Before Update event of a form.
"txtChangeTimeField" should be the name of the text box linked to the
date/time field in the table.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me!txtChangeTimeField = Now()
End If
End Sub

Now if you like to know when a record was originally created, create another
date/time field in the table with a default of Now().

If you'd like to know who last changed or created a record, check out:
http://www.mvps.org/access/api/api0008.htm

Now if you want to track every change, not just the last one, that's a much
more difficult question.
 
On the before update event of the form, add the code
Me.[Date field name] = Now()
 
how about if I wanted to track all history of changes. Right now I have a
table that records all the data and is a subdatasheet from a main table.

The user will be entering this data in a form.

Thanks
 
Lee said:
how about if I wanted to track all history of changes. Right now I
have a table that records all the data and is a subdatasheet from a
main table.

The user will be entering this data in a form.

Thanks

Hopefully someone will post the information you need for full history.
I could not find it myself. On of our regulars should come along and post
it. If it does not show up soon, try a new message asking for that.
 

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

Back
Top