Using Null and Not Null in IIF Statement

  • Thread starter Thread starter April
  • Start date Start date
A

April

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
 
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
 
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


Jen said:
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
-----Original Message-----
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
.
 
Thanks I'll Try this and let you know
-----Original Message-----
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
-----Original Message-----
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
.
.
 
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.

Duane said:
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

Jen said:
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
-----Original Message-----
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
.
 
Good catch.

--
Duane Hookom
MS Access MVP


John Spencer (MVP) said:
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.

Duane said:
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

Jen said:
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

-----Original Message-----
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
.
 
Back
Top