IIF

G

Gurtz

Hello,

I am using the IIF function in the Control Source field of
a properties dialogue:

=IIF([TextBox1]="" OR [TextBox2]="", "blank", "not blank")

However, this doesn't appear to work.. it just
returns "not blank" whether the fields are blank or not. I
also checked for Null instead of "" and got the same
result.

Any ideas?

Thanks,
Gurtz
[email = no $]
 
J

June Macleod

I found the code you used worked if you made the default value of TextBox1
and TextBox2 = to ""
or, if you don't want to set a default value the code below also works.

=IIF(isnull([TextBox1]) OR isnull([TextBox2]), "blank", "not blank")

June Macleod
 
J

jamie considine

First, check your boolean logic. I assume that if either
are blank, you want the result to be "blank", and if both
are filled, then you want the result to be "not blank".

Check to see if the 'blanks' are spaces, i.e. " "

I sometimes prefer to force the "not blank" condition by
doing the following:

=IIF(len([TextBox1])>0 and len([TextBox2])>0,"not
blank","blank")

The AND condition always seems to be easier to work with
than the OR condition.

Good Luck.

Jamie
 
T

Timothy C. Doherty

Try:

=IIF([TextBox1]="" OR [TextBox2]="" OR IsNull([TextBox1]) OR
IsNull([TextBox2]), "blank", "not blank")
 
Top