Using Null and Not Null in IIF Statement

Using Null and Not Null in IIF Statement

Post by Apri » Thu, 18 Sep 2003 01:32:37


I am trying to get the following Formula to work and I
don't know what I need to do? Can You help, this is what
I have:

IIf(([SIZE-KB-GW]=Null) Or ([ANumber-ADT]=Null) Or
([SMTP]=Null) Or ( [Comments]<> Null) ,"Y","")

Simply Put: IF
[Size-KB-GW] is Blank OR
[ANumber-ADT] is Blank OR
[SMTP] is Blank OR
[Comments] is not Blank
Then Place a "Y" in the [DiffRept] (This is a checkbox
field) otherwise do noting.

Thanks so Much.... April
 
 
 

Using Null and Not Null in IIF Statement

Post by Jen » Thu, 18 Sep 2003 02:02:16

Hi April,

Access doesn't recognize the Or clause in an IIf
statement. Try the following:

DiffRept: IIf(IsNull([SIZE-KB-GW]), "Y", IIf(IsNull
(ANumber-ADT]), "Y", IIf(IsNull([SMTP]), "Y", IIf(IsNull
([Comments]) = False, "Y", ""))))

Regards,
Jen

what

 
 
 

Using Null and Not Null in IIF Statement

Post by Duane Hook » Thu, 18 Sep 2003 02:29:15

IIf() does allows ORs and ANDs. Try:

IIf(IsNull([SIZE-KB-GW]) Or IsNull([ANumber-ADT]) Or IsNull([SMTP]) Or Not
IsNull([Comments]) ,"Y","")


--
Duane Hookom
MS Access MVP
 
 
 

Using Null and Not Null in IIF Statement

Post by Apri » Thu, 18 Sep 2003 03:02:07

Thanks I'll Try this and let you know
 
 
 

Using Null and Not Null in IIF Statement

Post by MV » Thu, 18 Sep 2003 09:14:49

Pardon me for jumping in, but instead of "Y", shouldn't we be returning TRUE and
False vice "". The OP did say something about a checkbox.
 
 
 

Using Null and Not Null in IIF Statement

Post by Duane Hook » Thu, 18 Sep 2003 13:01:37

Good catch.

--
Duane Hookom
MS Access MVP




TRUE and

Not