adding current date into table

N

Naresh Nichani MVP

Hi:

You could a field to Table say "DateLastUpdated" and in the
Form_BeforeUpdate event you could write this code --

Me.DateLastUpdated = VBA.Now()

Regards,

Naresh Nichani
Microsoft Access MVP
 
R

rglasunow

When I save a record through a form is there a way that I can save th
date in my table along with that record?
Thank you
 
J

John Vinson

When I save a record through a form is there a way that I can save the
date in my table along with that record?
Thank you!

Two ways:

- To store the date upon which the record was originally created, just
add a Date/Time field to the table with a Default property of Date()
(or, if you want the date and time, use Now() instead).

- To store the date upon which the record was modified, add a
date/time field and put the following code in the Form's BeforeUpdate
event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
<any record validation code goes here>
Me!timestampfieldname = Date() ' or Now() as above
End Sub
 

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