iif statement what is wrong with this expression

I

IR

I've written the following statement and I'm getting the following error, the
expression you entered has a function containing the wrong number of
arguments.

Iif([select]=1,"show",(iif(isnull([select]=true, (iif([HMO]=1, "show",(iif
(isnull([HMO]=true,"show","dont show"))
 
G

ghetto_banjo

the iif function requires both an "if true value" and "if false
value".

your second iif function is missing one of these values (probably the
true value judging by the way you have this setup)


i assume that if [select] is null, you want "show". you could really
get this down to one iif statement using the OR operator:

iif([select] = 1 OR IsNull([select]) OR [HMO] = 1 OR IsNull([HMO]),
"show", "dont show")



just a side note, you dont need the =true part after the IsNull
function. also naming a field "select" is not a good practice (keyword
in SQL).
 
D

Daryl S

IR -

IsNull takes only one argument, so it must have parentheses around the
argument. You do not need parentheses before the iif function. Try this:

Iif([select]=1,"show",iif(isnull([select])=true, iif([HMO]=1, "show",iif
(isnull([HMO])=true,"show","dont show"))))
 

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

Similar Threads


Top