Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iif function syntax problem

1 view
Skip to first unread message

angie

unread,
Jan 7, 2010, 10:24:01 AM1/7/10
to
i have the following expression in the criteria row of my query and it
returns no records. can you help me with the syntax?

IIf([Forms]![Form2-WAREHOUSE]![SPECIAL] Is
Null,[SPECIFIC-TBL.description],[SPECIFIC-TBL.description] Like "*" &
[Forms]![Form2-WAREHOUSE]![SPECIAL] & "*"))

when my form field is null i want the query to return all the records, but
if my form filed contains text i want the query to return all records that
contain my formfield text.

vanderghast

unread,
Jan 7, 2010, 10:37:11 AM1/7/10
to
At first glance, seems that


IIf

(

Forms![Form2-WAREHOUSE]!SPECIAL Is Null,

True,

[SPECIFIC-TBL].description Like "*" & Forms![Form2-WAREHOUSE]!SPECIAL & "*"


)

Note that you were using [SPECIFIC-TBL.description] where I assume it should
be [SPECIFIC-TBL].[description]: the difference is subtle, but the syntax
TABLENAME dot FIELDNAME should be kept (or [TableName] dot [FieldName], but
not [TableName dot FieldName] )

You also have an extra closing parenthesis.


Vanderghast, Access MVP

"angie" <an...@discussions.microsoft.com> wrote in message
news:DFC862FA-3416-48F9...@microsoft.com...

angie

unread,
Jan 7, 2010, 10:59:03 AM1/7/10
to
in another query i am using the following expression that works ok:

IIf([Forms]![Form2-WAREHOUSE]![SPECIAL] Is

Null,[SPECIFIC-TBL.description],[Forms]![Form2-WAREHOUSE]![SPECIAL])

i have tried your suggestion but i still get no results.

KARL DEWEY

unread,
Jan 7, 2010, 11:18:04 AM1/7/10
to
You did not response to the assumption that [SPECIFIC-TBL.description] was in
reality [SPECIFIC-TBL].[description]. What is the actual field and table
name?

Try this --
Like IIf([Forms]![Form2-WAREHOUSE]![SPECIAL] Is Null, "*", "*" &

[Forms]![Form2-WAREHOUSE]![SPECIAL] & "*")

--
Build a little, test a little.

angie

unread,
Jan 7, 2010, 11:37:01 AM1/7/10
to
this works ok,
thank you!

Duane Hookom

unread,
Jan 7, 2010, 11:44:04 AM1/7/10
to
I prefer:

Like "*" & [Forms]![Form2-WAREHOUSE]![SPECIAL] & "*"
Or [Forms]![Form2-WAREHOUSE]![SPECIAL] Is Null


--
Duane Hookom
Microsoft Access MVP

0 new messages