IIF statement...what is wrong w/ this expression?

K

Karen

I'm writing a nested IIF expression but I keep getting an error message:
"contains the wrong number of arguments". In the expression, I am creating a
field called Award Days and am including a field that I calculated earlier in
the query called Actual Open Date; the other fields are coming from linked
tables.

Award Days: = IIF(( [awarded]![Awarded] >0, [awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0, [UPCOMING]![Revised
Award date] -[Actual Open Date]), [awarded]![Awarded] -[Actual Open Date]))

Please advise - what is wrong w/ the formula?
 
V

Van T. Dinh

It looks like there are extra parens and they are at the wrong place. I am
not sure of what you are trying to do but try:

Award Days: = IIF( [awarded]![Awarded] >0,
[awarded]![Awarded] -[Actual Open Date],
IIF ( [UPCOMING]![Revised Award date] >0,
[UPCOMING]![Revised Award date] -[Actual Open Date],
[awarded]![Awarded] -[Actual Open Date]))
 
R

Ron2006

I believe you have one of the ) in an incorrect place......


You have Award Days: = IIF(( [awarded]![Awarded] >0,
[awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0,
[UPCOMING]![Revised
Award date] -[Actual Open Date]), [awarded]![Awarded] -[Actual Open
Date]))
/\

It should be:
Award Days: = IIF(( [awarded]![Awarded] >0, [awarded]![Awarded]
-[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0,
[UPCOMING]![Revised
Award date] -[Actual Open Date], [awarded]![Awarded] -[Actual Open
Date])))
from /\
to /\



Ron
 
B

Bill Mosca, MS Access MVP

Karen

I think this will do it:
IIF( [awarded]![Awarded] >0, [awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0, [UPCOMING]![Revised
Award date] -[Actual Open Date], [awarded]![Awarded] -[Actual Open Date]))
 
K

Karen

Thank you. The formula seems to work, except I am sometimes prompted for
paramaters when I try to run the query. Why is that?
--
Thanks, Karen


Bill Mosca said:
Karen

I think this will do it:
IIF( [awarded]![Awarded] >0, [awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0, [UPCOMING]![Revised
Award date] -[Actual Open Date], [awarded]![Awarded] -[Actual Open Date]))


--
Bill Mosca, MS Access MVP


Karen said:
I'm writing a nested IIF expression but I keep getting an error message:
"contains the wrong number of arguments". In the expression, I am
creating a
field called Award Days and am including a field that I calculated earlier
in
the query called Actual Open Date; the other fields are coming from linked
tables.

Award Days: = IIF(( [awarded]![Awarded] >0, [awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0, [UPCOMING]![Revised
Award date] -[Actual Open Date]), [awarded]![Awarded] -[Actual Open
Date]))

Please advise - what is wrong w/ the formula?
 
B

Bill Mosca, MS Access MVP

Karen

Whenever you get an unexpected prompt it usually means you spelled a field
incorrectly. Check your field names. The prompt should tell you what field
it's looking for.

--
Bill Mosca, MS Access MVP


Karen said:
Thank you. The formula seems to work, except I am sometimes prompted for
paramaters when I try to run the query. Why is that?
--
Thanks, Karen


Bill Mosca said:
Karen

I think this will do it:
IIF( [awarded]![Awarded] >0, [awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0, [UPCOMING]![Revised
Award date] -[Actual Open Date], [awarded]![Awarded] -[Actual Open
Date]))


--
Bill Mosca, MS Access MVP


Karen said:
I'm writing a nested IIF expression but I keep getting an error
message:
"contains the wrong number of arguments". In the expression, I am
creating a
field called Award Days and am including a field that I calculated
earlier
in
the query called Actual Open Date; the other fields are coming from
linked
tables.

Award Days: = IIF(( [awarded]![Awarded] >0,
[awarded]![Awarded] -[Actual
Open Date], IIF ( [UPCOMING]![Revised Award date] >0,
[UPCOMING]![Revised
Award date] -[Actual Open Date]), [awarded]![Awarded] -[Actual Open
Date]))

Please advise - what is wrong w/ the formula?
 

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