IF statement

ThaiByThai

Registered User.
Local time
Today, 08:43
Joined
Aug 12, 2009
Messages
21
Hi -

is there a way i can nest an IF statement with 4 criteria? in my access2007
i have a field called dateuse =>
DateUse: IIf([DATE1] Is Null,[Date2],IIf([DATE1]>[Date2],[DATE1],IIf([DATE1]<[Date2],[Date2],[DATE1])))

Then i have a another field called Type =>
CCB
CCB-PR
SSB
SSB-V

then i have another field called Status =>

Blank
NC
S
C

what i want to see is IF Type = to CCB and CCB-PR AND status = to S and NC THen Dateadd (m-6, dateadd(yyyy',10,[dateuse])


is this possible? Or do i need to break down the fields?

the table already have a million fields to it :-(
 
oK - So i gave it a try and got an error about a comma?? "Syntax error (comma) in query expression IF............."

this is what i have...

TEST: IIf([TYPE]="CCB" OR [TYPE]="CCB-PR" OR [Status]="S" OR[Status]="NC",DateAdd("m",-6,("yyyy",10,[DateUse])))
 
As typed the Dateadd is definitely wrong

Brian
 
Hi Brianwarnock -

Thank you, I just sort of play with the dateadd realize i am using the Dateuse within the datedd so that's just going to work... i havent figure out how to get the criteria to work... any suggestion?
 
If you want to subtract 6 months from DateUse then the last expression should be:

DateAdd("m",-6,[DateUse])

I assume DateUse is a Date datatype?

Chris
 

Users who are viewing this thread

Back
Top Bottom