Date of the last time a record was saved

N

Nick

Im trying to insert todays date into a form which, when a button is pressed,
will save the information in the form as well as the date on the form into a
field in a table.
Im using it to call clients and log the date I called them, so that I can
look back in the table to see when each client was last contacted.
Any help is greatly appreciated
cheers
 
D

Douglas J. Steele

Put logic in the form's BeforeUpdate event. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!LastUpdated = Now()

End Sub
 
K

Keith Wilby

Nick said:
Im trying to insert todays date into a form which, when a button is
pressed,
will save the information in the form as well as the date on the form into
a
field in a table.

That makes no sense. Data is stored in fields in tables. Forms are bound
to tables and used to manipulate the data.
Im using it to call clients and log the date I called them, so that I can
look back in the table to see when each client was last contacted.
Any help is greatly appreciated
cheers

Set the default value of the date field's text box to "=Date()"

HTH - Keith.
www.keithwilby.com
 
N

Nick

Douglas J. Steele said:
Put logic in the form's BeforeUpdate event. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!LastUpdated = Now()


So Me!LastUpdated is the table and field?
Silly question but would this be correct:
Lead_Responses!Date_of_Last_update = Date()
 
D

Douglas J. Steele

Nick said:
So Me!LastUpdated is the table and field?
Silly question but would this be correct:
Lead_Responses!Date_of_Last_update = Date()

No, Me refers to the form in which the code is running. LastUpdated is
either a control on that form, or a field in the form's underlying
recordset. If your field is named "Date_of_Last_update", use

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!Date_of_Last_update = Date()

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