IIf expression

D

Don

I am trying to have an expression return "Expired" if the date difference is
over 30 days and if under 30 days, the number of days in the following
expression:

IIf(DateDiff(“dâ€,[CommitteeDate],Now()>30),â€Expiredâ€,(DateDiff(“dâ€,[CommitteeDate],Now())))

Of course it does not work. Any Ideas where I am going wrong?
 
A

AccessVandal via AccessMonster.com

Maybe it should be

IIf(DateDiff(“dâ€,[CommitteeDate],Now())>30,â€Expiredâ€,(DateDiff(“dâ€,
[CommitteeDate],Now())))
I am trying to have an expression return "Expired" if the date difference is
over 30 days and if under 30 days, the number of days in the following
expression:

IIf(DateDiff(“dâ€,[CommitteeDate],Now()>30),â€Expiredâ€,(DateDiff(“dâ€,[CommitteeDate],Now())))

Of course it does not work. Any Ideas where I am going wrong?
 
T

tina

i agree with AccessVandal, my only additional notes being that 1) you have
an extra set of parentheses that you don't need, around the last argument
and 2) Now() returns current date AND time whereas Date() returns current
date only. unless time is a factor in this situation, try

IIf(DateDiff("d",[CommitteeDate],Date())>30,"Expired",DateDiff("d",
[CommitteeDate],Date()))

hth
 

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