iif statement

  • Thread starter Thread starter alecgreen
  • Start date Start date
A

alecgreen

Hi

I want to use an IIf statement to decide if a date field is between
today date and up 10 day ago. I figure the statement would be
something like this: result:iif([date] is between date() and date()
+10,"true","false") but this doesn't work!

Any ideas please

Alec
 
Hi Alec,

try this:
My_Result: IIf([My_date]>Date() And [My_date]<Date()+10,"true","false")
Please note that Date is reserved word in Access.

Stefan.
 
I think you have reversed your logic.

To compute a date that is 10 days ago from today then you SUBTRACT 10
not add it.

The test should be:

result:iif([lookedatdate] between date()-10 and date
(),"true","false")

Ron
 
AlecGreen,

You are close on your IIF, except you need to subtract to check a date in
the past. As your idea is written you would be check your date between today
and 10 days in the future.

It should be: iif([YourDate] is between date() and
(date()-10),"true","false")

Hope this helps out.
 
I have never actually tested it, but shouldn't the earlier date ALWAYS
be the first date mentioned?

I guess it all depends on how the between function actually performs
the tests.

Ron
 
Back
Top