Nesting IIf functions

K

KenRamoska

Thanks to some wonderful people here (Doug!) I now think I know how to use
this function called IIF. Here is my example.

=IIf([Program]="NPM" And [NeedCore]="Y",[StartDate]+70,IIf([Program]="NPM"
And [NeedCore]="N",[StartDate]+35,IIf([Program]="CSM" And
[NeedCore]="Y",[StartDate]+84,IIf([Program]="CSM" And
[NeedCore]="N",[StartDate]+49,IIf([Program]="PM" And
[NeedCore]="Y",[StartDate]+105,IIf([Program]="PM" And
[NeedCore]="N",[StartDate]+70,""))))))

I still get a blank though. Basically I have 3 fields Program, NeedCore, and
StartDate. Based on answers from the first 2 I want to add days to the start
date and put that in a new field called ProjEndDate. I did the above and I
come up blank. No error message. Just blank.
Any help would be appreciated.
 
K

KARL DEWEY

Another way besides Iif's. Build a truth table of the data and join in a query.

SELECT [YourDataTable-1].Program, [YourDataTable-1].NeedCore,
[YourDataTable-1].Data, [YourDataTable-1].StartDate,
TruthTable.[StartDate-add], [StartDate]+[StartDate-add] AS NewDate
FROM [YourDataTable-1] LEFT JOIN TruthTable ON ([YourDataTable-1].NeedCore =
TruthTable.NeedCore) AND ([YourDataTable-1].Program = TruthTable.Program);
 

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

Similar Threads


Top