If then statement

J

Jennyrd

I'm trying to write an if then statement where one value is null and the
other is not. This is what I'm trying to write in words:
If name is null and comment is not null then pop up a message box, else
close window.
Thanks for any help you can provide!!
-Jenny
 
A

Access101

Let me know if this helps:

If IsNull(Name) And Not IsNull(Comment) Then

"Name" might be a reserved word--assuming you're using that from your
description.
 
A

Al Campagna

Jenny,
First, avoid using the field name NAME. It's a reserved word in Access.
I'll use LastName.

I'll also assume that "close window" means a "close the form."

If IsNull([LastName]) And Not IsNull([Comments]) Then
MsgBox "LastName is Null and Comments are not Null!"
Else
DoCmd.Close
End If
 
Top