On Exit Event Procedure evaluates improperly when Null

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
 
R

Rick B

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
 
D

Douglas J. Steele

Or if the field is text,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top