IIf statement with IS Null

A

AJ Sless

I am trying to use IS Null in an Iif statement and it is
not working.

I want to be able to exclude certain part #s based on a
condition, so I am trying to make an If statement in
Access that will say,

If aff="test", then only show my NULLs, otherwise show me
everything. I can put Is Null in the conditions record
and it works fine. It doesn't seem to work when I combine
with an If statement.

Can anyone help me out?
 
M

Marcus Armand

I have had no problems using IsNull

IIF(IsNull([Control]),"x","xx")

Marcus Armand
 
J

John Vinson

I am trying to use IS Null in an Iif statement and it is
not working.

You need to use the IsNull() *function* instead.
I want to be able to exclude certain part #s based on a
condition, so I am trying to make an If statement in
Access that will say,

If aff="test", then only show my NULLs, otherwise show me
everything. I can put Is Null in the conditions record
and it works fine. It doesn't seem to work when I combine
with an If statement.

Is this a criterion on a Query? If so you don't need IIF at all: use a
criterion on aff of

WHERE [aff] = "Test" AND <fieldname> IS NULL OR [aff] <> "Test"

You don't say what you mean by "show my nulls" - i.e. what field or
fields are NULL, so this may not be exactly what you want!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top