IIF Statement Help

T

Terrence Carroll

I am getting an error messge saying a I am missing a ( or|and I can not
figure out what is wrong. Can you please assist with debugging the following
code:

Test: IIF(Month(Date())>10 AND Month([Contract Info].[Start Date])<3,
Year(Date())+1, Year(Date())

Essentially I want this calculated field to take a look at the current month
and for January and February add one the the current year, otherwise the
field should be the current year
 
G

ghetto_banjo

you are missing a parenthesis at the very end.

that last parenthesis you have is ending only the Year function, but
you also need to end the iif function.
 
J

John W. Vinson

I am getting an error messge saying a I am missing a ( or|and I can not
figure out what is wrong. Can you please assist with debugging the following
code:

Test: IIF(Month(Date())>10 AND Month([Contract Info].[Start Date])<3,
Year(Date())+1, Year(Date())

Essentially I want this calculated field to take a look at the current month
and for January and February add one the the current year, otherwise the
field should be the current year

What I do in these cases is to read through the expression left to right,
mentally adding 1 for each left parenthesis and subtracting 1 for each right.
If I do this in your expression I end up with +1. You're missing the final
closing parenthesis for the IIF() function.
 

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