Change date after edit

D

Don James

Hi
I have a table containing customer data such as name, address, city etc. My
"add customer" form also contains a "date entered" with a default DATE().
All of this works fine. I also have a "Edit Customer" form. What I would
like is a way for the "date entered" to automatically update ONLY if there
were changes made to any field in the record. Is there a way to do this?

Thanks
dj
 
P

Peter Doering

I have a table containing customer data such as name, address, city etc. My
"add customer" form also contains a "date entered" with a default DATE().
All of this works fine. I also have a "Edit Customer" form. What I would
like is a way for the "date entered" to automatically update ONLY if there
were changes made to any field in the record. Is there a way to do this?

Move the update of your date field to the Form_BeforeUpdate event.

HTH - Peter
 
C

Con Giacomini

Add a "Date Modified" field to the table.

Use the following code in the form's BeforeUpdate event.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![Date Modified].Value = Date
End Sub

Con Giacomini
 

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