Checking for value changed

J

John

Hi

When a user has modified a text box how can I check if the value has
actually been changed form what it was and the value is not null or empty?

Thanks

Regards
 
A

Allen Browne

Until the record is saved, you can compare the Value of a control to its
OldValue.

This example tests whether a control changed at the last possible moment
before the record is saved:

Private Sub Form_BeforeUpdate(Cancel As Integer)
With Me.[YourControlNameHere]
If (.Value = .OldValue) OR (IsNull(.Value) AND IsNull(.OldValue))
Then
Debug.Print "unchanged"
Else
Debug.Print "Changed from " & .OldValue & " to " & .Value
End If
End With
End Sub
 
Top