IIf statement with IS Null

  • Thread starter Thread starter AJ Sless
  • Start date Start date
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?
 
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!
 
Back
Top