Use the IsNull() function to test if a value is null in VBA;
If IsNull(Me.[description]) Then
In VBA, the "Is" operator is reserved for examining objects, hence the
"object is required" error.
You cannot use "=" with Null, because two Nulls are not equal. In fact,
nothing is ever equal to Null. For an explanation, see:
Common errors with Null
at:
http://members.iinet.net.au/~allenbrowne/casu-12.html
The article explains that any comparision involving Null can have 3
outcomes: True, False, or Null (unknown).
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"N. Graves" <ng*****@REMOVEyahoo.com> wrote in message
news:g1********************************@4ax.com...
Thanks for reading my question.. This Newsgroups is great!!
I'm having a senior moment and remember...
if I have a field in a record that is null and I want to do an IF
Statement based on if null or not what is the syntax
If [description ] is null then
msgbox("Description is empty)
End if
I get error "object is required"
If [description ] = null then
msgbox("Description is empty)
ELSE
msgbox("Description is not empty)
End if
It will take the Else leg of the if statement.
What is the correct code if description is null?
Thanks
N. Graves