R
Rick
I need help with oldvalue...
Ok - I have a field to indicate when a record has been
modified. I want to indicate at the end of the field what
type of change was made to the record. This code works
ONCE. But, let's say I enter a date of 12/15/03 in a
record, the timestamp is updated and indicates a date
change. If I go to another record and enter a different
date, it works. If I go to another record and enter
12/15/03, it does not indicate a date change. Any
suggestions? My understanding of 'oldvalue' is that it
stores the old value when you move the focus to a new
record.
Here is my code...
--------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Dim Datechg
Datechg = ""
If InstallDate.Value <> InstallDate.OldValue Or
DateCompleted.Value <> DateCompleted.OldValue Then Datechg
= "D"
Dim Succchg
Succchg = ""
If SuccessFactor.Value <> SuccessFactor.OldValue Then
Succchg = "S"
Dim Milechg
Milechg = ""
If Travel_Requested.Value <> Travel_Requested.OldValue Or
Readiness.Value <> Readiness.OldValue _
Or Prelaunch.Value <> Prelaunch.OldValue Or
Checklist.Value <> Checklist.OldValue Or _
Signoff.Value <> Signoff.OldValue Or ATB.Value <>
ATB.OldValue Or Followup.Value <> Followup.OldValue _
Then Milechg = "M"
Dim UserChg
UserChg = ""
If UserID.Value <> UserID.OldValue Then UserChg = "U"
If SupervisorIfBorrowed.Value <>
SupervisorIfBorrowed.OldValue Then UserChg = "U"
Me.Timestamp = Format(CurrentUser, ">") & " " & date & " "
& Time & Datechg & Succchg & Milechg & UserChg
End If
End Sub
Ok - I have a field to indicate when a record has been
modified. I want to indicate at the end of the field what
type of change was made to the record. This code works
ONCE. But, let's say I enter a date of 12/15/03 in a
record, the timestamp is updated and indicates a date
change. If I go to another record and enter a different
date, it works. If I go to another record and enter
12/15/03, it does not indicate a date change. Any
suggestions? My understanding of 'oldvalue' is that it
stores the old value when you move the focus to a new
record.
Here is my code...
--------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Dim Datechg
Datechg = ""
If InstallDate.Value <> InstallDate.OldValue Or
DateCompleted.Value <> DateCompleted.OldValue Then Datechg
= "D"
Dim Succchg
Succchg = ""
If SuccessFactor.Value <> SuccessFactor.OldValue Then
Succchg = "S"
Dim Milechg
Milechg = ""
If Travel_Requested.Value <> Travel_Requested.OldValue Or
Readiness.Value <> Readiness.OldValue _
Or Prelaunch.Value <> Prelaunch.OldValue Or
Checklist.Value <> Checklist.OldValue Or _
Signoff.Value <> Signoff.OldValue Or ATB.Value <>
ATB.OldValue Or Followup.Value <> Followup.OldValue _
Then Milechg = "M"
Dim UserChg
UserChg = ""
If UserID.Value <> UserID.OldValue Then UserChg = "U"
If SupervisorIfBorrowed.Value <>
SupervisorIfBorrowed.OldValue Then UserChg = "U"
Me.Timestamp = Format(CurrentUser, ">") & " " & date & " "
& Time & Datechg & Succchg & Milechg & UserChg
End If
End Sub