A Field To Record Exactly When A Record Was Updated

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I am developing an application for a group of user's, and
there is a requirement that a field be included in every
table, that is able to record exactly when each record is
updated or created (New Record)- this field might be
called [UpdatedOn] for example. Question, how am I able
to acheive this goal and the answer must be able to be
used in several forms in the same database. I have tried
using - Me.UpdatedOn = Now() - but this only seems to
work on one form in database, does anybody know of a way
to modify the event procedure to reference other forms in
the same database ie Forms!frmPrimarySubForm[UpdatedOn =
Now() or something similar. Thank you all for your time
and effort.
 
I use the following in my forms...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
End Sub




I am developing an application for a group of user's, and
there is a requirement that a field be included in every
table, that is able to record exactly when each record is
updated or created (New Record)- this field might be
called [UpdatedOn] for example. Question, how am I able
to acheive this goal and the answer must be able to be
used in several forms in the same database. I have tried
using - Me.UpdatedOn = Now() - but this only seems to
work on one form in database, does anybody know of a way
to modify the event procedure to reference other forms in
the same database ie Forms!frmPrimarySubForm[UpdatedOn =
Now() or something similar. Thank you all for your time
and effort.
 
I think I would use an UPDATE SQL statement that is not form-specific. You
could execute the SQL statement from a method that could be called from
anywhere.

Bill Nicholson
Access Dufus
 
I've just tried to modify the event procedure and it
does not work - I get a compile error on Timestamp. I
think the problem is replacing "Me with somekind of
absolute reference.
 
Do you have a field in your table named "timestamp"?

Rick


I've just tried to modify the event procedure and it
does not work - I get a compile error on Timestamp. I
think the problem is replacing "Me with somekind of
absolute reference.
 
Thanks for the input, but exactly how would I do what you
suggest?


-----Original Message-----
I think I would use an UPDATE SQL statement that is not form-specific. You
could execute the SQL statement from a method that could be called from
anywhere.

Bill Nicholson
Access Dufus

I am developing an application for a group of user's, and
there is a requirement that a field be included in every
table, that is able to record exactly when each record is
updated or created (New Record)- this field might be
called [UpdatedOn] for example. Question, how am I able
to acheive this goal and the answer must be able to be
used in several forms in the same database. I have tried
using - Me.UpdatedOn = Now() - but this only seems to
work on one form in database, does anybody know of a way
to modify the event procedure to reference other forms in
the same database ie Forms!frmPrimarySubForm[UpdatedOn =
Now() or something similar. Thank you all for your time
and effort.


.
 
No should I have?
-----Original Message-----
Do you have a field in your table named "timestamp"?

Rick


I've just tried to modify the event procedure and it
does not work - I get a compile error on Timestamp. I
think the problem is replacing "Me with somekind of
absolute reference.

-----Original Message-----
I use the following in my forms...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
End Sub




I am developing an application for a group of user's, and
there is a requirement that a field be included in every
table, that is able to record exactly when each record is
updated or created (New Record)- this field might be
called [UpdatedOn] for example. Question, how am I able
to acheive this goal and the answer must be able to be
used in several forms in the same database. I have tried
using - Me.UpdatedOn = Now() - but this only seems to
work on one form in database, does anybody know of a way
to modify the event procedure to reference other forms in
the same database ie Forms!frmPrimarySubForm[UpdatedOn =
Now() or something similar. Thank you all for your time
and effort.



.


.
 
Rick said:
I use the following in my forms...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
End Sub

Multiple pieces of data in one field? For shame! : )

Also, Timestamp is a DataType in many DBMS so I would not use that name
just to avoid confusion. I prefer two simple fields: RevisedBy and
RevisedOn. It's obvious to anyone looking at them what they are and it's
properly normalized.
 
Back
Top