B
Brad
If I use “=†when comparing two fields and one field contains nulls, I obtain
the results that I would expect.
However, if I use “<>†when comparing the same two fields I see a result
that I do not expect.
I have trimmed down the code to the following pseudo-code examples to
simplify things.
~ ~ ~
Field1 is null
Field2 is = “Aâ€
~ ~ ~ TEST1
If Field1 = Field2 Then
Msgbox “Equalâ€
Else
Msgbox “NOT Equalâ€
End if
~ ~ ~ TEST2
If Field1 <> Field2 Then
Msgbox “NOT Equalâ€
Else
Msgbox “Equalâ€
End if
~ ~ ~
TEST1 works as I would expect, and returns a message of “NOT Equalâ€
(This is because “A†is not equal to Nulls)
TEST2 returns a message of “Equalâ€
HUH????? Why does it indicate that “A†is equal to Nulls)
~ ~ ~
Can someone explain this to me?
Please type real slow, as I am having a difficult time surrounding this
I realize that I can simply avoid using “<>†in future VBA code, but I would
like to understand the rest of the story.
Thanks,
Brad
the results that I would expect.
However, if I use “<>†when comparing the same two fields I see a result
that I do not expect.
I have trimmed down the code to the following pseudo-code examples to
simplify things.
~ ~ ~
Field1 is null
Field2 is = “Aâ€
~ ~ ~ TEST1
If Field1 = Field2 Then
Msgbox “Equalâ€
Else
Msgbox “NOT Equalâ€
End if
~ ~ ~ TEST2
If Field1 <> Field2 Then
Msgbox “NOT Equalâ€
Else
Msgbox “Equalâ€
End if
~ ~ ~
TEST1 works as I would expect, and returns a message of “NOT Equalâ€
(This is because “A†is not equal to Nulls)
TEST2 returns a message of “Equalâ€
HUH????? Why does it indicate that “A†is equal to Nulls)
~ ~ ~
Can someone explain this to me?
Please type real slow, as I am having a difficult time surrounding this
I realize that I can simply avoid using “<>†in future VBA code, but I would
like to understand the rest of the story.
Thanks,
Brad