Date Update to Current Date

JackG

New member
Local time
Today, 14:06
Joined
Apr 5, 2003
Messages
7
I'm using A2K and very new to Access. I want to have a text box (with a control source) update itself with the current date when any change is made to the current record.

I read somewhere in here that the "Dirty" command could do something like that but there was not enough info there for me to act on.

Thanks in advance for your wisdom!
 
Put the code in the BeforeUpdate event of the Form.

Me.LastUpdateDt = Now()
 
I'm doing something wrong...

I put the following in the properties for the text box. An error says it can't find a Macro??? What am I doing wrong? I'm new to the code stuff. Thanks....

--------------------------------------------------------------
Private Sub dtmUpdateDate_BeforeUpdate(Cancel As Integer)
Me.LastUpdateDt = Now()

End Sub
--------------------------------------------------------------
 
You need to put the code in the BeforeUpdate event
of the Form
. Also, you need to use your own column name. Change "LastUpdateDt" to whatever your column name is.
 
That did it... Thanks
Evidently I can't read either :rolleyes:
 
following on from your thread guys,

how can do you implement a 'todays date/ time' function when a new record is added rather than a field that has been amended?
 
If you only want to populate the field on "add" and never change it, put
Now()
in the table column's default property.
 
Thanks Pat i will try that today.

Yeah on the form load up i want the current date to display in a text box, and update every day.

You say the columns update property? is that the text boxes before update property i.e.

Private Sub Text7_BeforeUpdate(Cancel As Integer)
Me.Text7 = Now()

or have i got the wrong end of the stick?
 

Users who are viewing this thread

Back
Top Bottom