DtheHut
DtheHut

Reputation: 51

iif() statement in Access

I have an if statement that is returning a #type! error on my form in Access:

IIF([Responsible]=Null,"UNASSIGNED",[Responsible])

What I'm trying to achieve is for it return the name of a person assigned to a task (which works without the expression), and when no one is assigned, for it to return the text 'UNASSIGNED'. I'm not clear on why it isn't working.

Upvotes: 1

Views: 793

Answers (2)

HansUp
HansUp

Reputation: 97101

Since the context is an Access form, Nz can accomplish what you need more concisely.

Nz([Responsible],"UNASSIGNED")

Upvotes: 1

just like they said, you can't compare null in VBA, so do it like this:

IIF(IsNull([Responsible]),"UNASSIGNED",[Responsible])

Upvotes: 2

Related Questions