On Exit Event Procedure evaluates improperly when Null

  • Thread starter Thread starter Mark Wolven
  • Start date Start date
M

Mark Wolven

I have a Form that is using the following code on an On Exit Event
Procedure - it works when I have a text string that I change to a
differenct text string. However, if the field is blank (Null) and I
add text, it doesn't evaluate properly. What I am trying to do is
update the [DateMapped] field when I make a change in the
[SourceField] field. Thoughts?

Private Sub Source_Field_Exit(Cancel As Integer)
If Me.Source_Field <> Me.Source_Field.OldValue Then
Me![DateMapped] = Date
End If
End Sub
 
You have to give it a value if null...

If (Nz(Source_Field.Value, 0) <> Nz(Source_Field.OldValue, 0)) Then

Rick B

I have a Form that is using the following code on an On Exit Event
Procedure - it works when I have a text string that I change to a
differenct text string. However, if the field is blank (Null) and I
add text, it doesn't evaluate properly. What I am trying to do is
update the [DateMapped] field when I make a change in the
[SourceField] field. Thoughts?

Private Sub Source_Field_Exit(Cancel As Integer)
If Me.Source_Field <> Me.Source_Field.OldValue Then
Me![DateMapped] = Date
End If
End Sub
 
Or if the field is text,

If (Nz(Source_Field.Value, "") <> Nz(Source_Field.OldValue, "")) Then
 
Back
Top