Update date after change in form

  • Thread starter Thread starter Jason Frazer
  • Start date Start date
J

Jason Frazer

How can i have the date field update to the current date
if any fields in the form change value?

Thanks for your time and help!

Jason
 
I did what you said but something is not working. When I
edit any field the date does not update to the current
date. I put this in "Me!.[Date] = Date". The () disappears
after i close visual Basic. The Date field is in a
updateable query. Maybe You can't update a field in a
query this way. How can I update the Date in the
Table "Table1"?

Thanks for your time and help

Jason Frazer
-----Original Message-----
Jason Frazer said:
How can i have the date field update to the current date
if any fields in the form change value?

Thanks for your time and help!

In the BeforeUpdate event of the Form...

Me![YourDateField] = Now()
or
Me![YourDateField] = Date()

The first includes the time whereas the second is the date only.


.
 
Jason Frazer said:
I did what you said but something is not working. When I
edit any field the date does not update to the current
date. I put this in "Me!.[Date] = Date". The () disappears
after i close visual Basic. The Date field is in a
updateable query. Maybe You can't update a field in a
query this way. How can I update the Date in the
Table "Table1"?

What should be in the Code module...

either
Me![Date] = Date
or
Me.[Date] = Date

You have both the bang (!) and the dot(.) and there should not be quotes around it.
[Date] needs to be a control on the form or a field in the form's RecordSet. You
really should not use "Date" as a name for a control or a field, but the brackets
surrounding it "should" let Access distinguish it from the function Date(). I would
suggest [RevisedDate] as a better alternative.
 
Back
Top