Nested If Statements

A

Alex Hammerstein

Hi

I am trying to get a nested if statement to work, which includes some date
fields.

Part of by query is:
IIf([Date Started]>#31/07/2007#,DateDiff("ww",[DateStarted,#31/07/2008#),

At the present moment the query will select all records where date started
is greater than 31/7/07. However if I wanted to filter the records where
[Date Started] is between 1/8/07 and 31/7/08 how would I do this please

Many thanks

Alex
 
P

PieterLinden via AccessMonster.com

Alex said:
Hi

I am trying to get a nested if statement to work, which includes some date
fields.

Part of by query is:
IIf([Date Started]>#31/07/2007#,DateDiff("ww",[DateStarted,#31/07/2008#),

At the present moment the query will select all records where date started
is greater than 31/7/07. However if I wanted to filter the records where
[Date Started] is between 1/8/07 and 31/7/08 how would I do this please

Many thanks

Alex

Did you actually try using BETWEEN?
IIF([Date Started] BETWEEN #3/1/2007# AND #7/31/2008#, True Part, False Part)

If that doesn't work, use
IIF([Date Started]>= #8/1/07# AND [Date Started]<=#7/31/08#, True Part, False
Part)
 

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