Last Updated Field

JVermast

Registered User.
Local time
Today, 04:57
Joined
Jun 15, 2005
Messages
70
Is there any way to make a date change to the current date/time whenever something on a report is edited? I have a "Last Updated" field but I want it to automatically update itself.
 
Reports don't alter data. You would need to place code in the form where the changes are made. Only one line of code is necessary and it MUST go in the FORM's BeforeUpdate event:

Me.yourdatefield = Now()

Now() stores both date and time. If you prefer only date, then use Date() instead.
 
alright I edited the code to say:

Private Sub Text23_BeforeUpdate(Cancel As Integer)
Me.Text23 = Date
End Sub

When I put () it just dissapears. I updated a field in that record but it didnt add the date.
 
Please read my post again. That is NOT where I told you to put the code. I told you to put the code in the FoRM's BeforeUpdate event. You put the code in a control's BeforeUpdate event.

If you use a control's BeforeUpdate event, the code will only run if THAT field is modified. That is why the code belongs in the FORM level event. Then it will run if ANY field on the form is modified.
 
Pat Hartman said:
Please read my post again. That is NOT where I told you to put the code. I told you to put the code in the FoRM's BeforeUpdate event. You put the code in a control's BeforeUpdate event.

If you use a control's BeforeUpdate event, the code will only run if THAT field is modified. That is why the code belongs in the FORM level event. Then it will run if ANY field on the form is modified.

I said "Got it. Thanks" for a reason :)
 

Users who are viewing this thread

Back
Top Bottom