R
Rick
I have a timestamp field that gets updated when a record is changed. I'd
like to know what type of change was made. For example, if they changed one
of the date fields in my record, I want to put a "d" in my timestamp. If
the change a money field, I would like to put an "M". etc.
In my module, I defined a string StTimeType.
In my 'before update' I have code like:
If Me.Dirty Then
StTimeType = ""
If (DateCompleted.OldValue <> DateCompleted.Value) Or
(InstallDate.OldValue <> InstallDate.Value) Then
StTimeType = StTimeType & "D"
End If
If (SalePrice.OldValue <> SalePrice.value) Or (Cost.OldValue <>
Cost.Value) Then
StTimeType = StTimeType & "M"
End If
If (Installer.OldValue <> Installer.Value) Then
StTimeType - StTimeType & "I"
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
This works very well except, if I have a blank (null) date when I enter the
form, and I enter a date, the 'D' does not appear. If I have a date, and
blank it our, the 'D' does not appear. Basically, it only works if there is
a value, and I change that value. Doesn't my code imply that if the field
is null (oldvalue) and I change it to a date (value), that the two are not
equal(<>).
Thanks for any advice.
Rick
like to know what type of change was made. For example, if they changed one
of the date fields in my record, I want to put a "d" in my timestamp. If
the change a money field, I would like to put an "M". etc.
In my module, I defined a string StTimeType.
In my 'before update' I have code like:
If Me.Dirty Then
StTimeType = ""
If (DateCompleted.OldValue <> DateCompleted.Value) Or
(InstallDate.OldValue <> InstallDate.Value) Then
StTimeType = StTimeType & "D"
End If
If (SalePrice.OldValue <> SalePrice.value) Or (Cost.OldValue <>
Cost.Value) Then
StTimeType = StTimeType & "M"
End If
If (Installer.OldValue <> Installer.Value) Then
StTimeType - StTimeType & "I"
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
This works very well except, if I have a blank (null) date when I enter the
form, and I enter a date, the 'D' does not appear. If I have a date, and
blank it our, the 'D' does not appear. Basically, it only works if there is
a value, and I change that value. Doesn't my code imply that if the field
is null (oldvalue) and I change it to a date (value), that the two are not
equal(<>).
Thanks for any advice.
Rick