TimeStamp Field in Access Table?

D

Dan Johnson

Is it possible to add a date/time field to an Access table that is
automatically updated every time the record is changed? Sorry if this has
been asked before...I tried looking through recent topics and didn't see it.

Dan
 
A

Allen Browne

You cannot do this at the table-level in Access.

If your data is edited in a form, you can use the BeforeUpdate event of the
form to assign the value of Now() to the date/time field, e.g.:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourTextBoxHere] = Now()
End Sub
 
D

Dan Johnson

Thanks Allen.

Do you know off the top of your head if I can use an ADODB.Recordset event
in VB6 to make sure a TimeStamp field is always updated when a record is
changed?

Dan

Allen Browne said:
You cannot do this at the table-level in Access.

If your data is edited in a form, you can use the BeforeUpdate event of the
form to assign the value of Now() to the date/time field, e.g.:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourTextBoxHere] = Now()
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Dan Johnson said:
Is it possible to add a date/time field to an Access table that is
automatically updated every time the record is changed? Sorry if this has
been asked before...I tried looking through recent topics and didn't see
it.
 
A

Allen Browne

If you are updating via a recordset, then you can code it so that the
particular date/time field is updated as well.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Dan Johnson said:
Thanks Allen.

Do you know off the top of your head if I can use an ADODB.Recordset event
in VB6 to make sure a TimeStamp field is always updated when a record is
changed?

Dan

Allen Browne said:
You cannot do this at the table-level in Access.

If your data is edited in a form, you can use the BeforeUpdate event of the
form to assign the value of Now() to the date/time field, e.g.:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourTextBoxHere] = Now()
End Sub

Dan Johnson said:
Is it possible to add a date/time field to an Access table that is
automatically updated every time the record is changed? Sorry if this has
been asked before...I tried looking through recent topics and didn't
see
it.
 

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