G
Guest
I have a query make-table query that works. However, I need to add one more
if statement and when I do, along with the additional left ), I get a message
"Query too Complex..."
Is there a limit on the number of if statements Access2003 can handle?
Here is the query that works:
SELECT tg.ImportID, tg.App_ID, tg.Equipment_ID, tg.ItemID, tg.Manufacturer1,
Manufacturer2, tg.Model_No1, tg.BTUH, tg.System, tg.Product, tg.Cooling,
tg.EER, tg.SEER, tg.IPLV, tg.HighCOP, tg.LowCOP, tg.HSPF, tg.TXV, tg.ESTier,
tg.ESRebate_AmtH, tg.ESRebate_Per_Ton, ESApprove_FlagH, IIf(([Product]="AC"
Or [Product]="HP") And ([System]="S" Or [System]="P"),
IIF(([Cooling]="W" AND [EER]>=14 AND [BTUH] >=135000), "S213",
IIF(([Cooling]="W" AND [EER]>=14 AND [BTUH] <135000), "S216",
IIf([BTUH]>240000 AND [IPLV]>=10.4,"S218",
IIf(([BTUH]>=135000 And [BTUH]<=240000) AND [EER]>=10.8 AND
[IPLV]>=11.2,"S217",
IIf(([BTUH]>=65000 And [BTUH]<135000 AND [EER]>=11),"S216",
IIf(([BTUH]<65000 AND ( [EER]>=12 Or [SEER]>=14) And [TXV]=True) and
[Cooling]="A","S181",
IIf(([BTUH]<65000 AND ([EER]>=11.6 Or [SEER]>=14) And [System]="P" and
[Cooling]="A"),"S182",
IIf(([BTUH]<65000 AND (([EER]>=11.6 AND [EER]<12) Or ([SEER]>=13 AND
[SEER]<14)) And [TXV]=True),"S214",
IIf(([BTUH]<65000 AND (([EER]>=11.3 AND [EER]<11.6) Or ([SEER]>=13 AND
[SEER]<14)) And [System]="P" And [Cooling]="A"),"S215",
IIf(( [BTUH]<65000 AND [Cooling]="A" AND (([EER]>=11 AND [EER]<11.3) Or
([SEER]>=13)) And [System]="S" ),"S104",
IIf(([BTUH]<65000 AND ([EER]>=11 Or [SEER]>=12) And nz([SEER],0)<13 And
[System]="P" ) AND [Cooling]="A","S105",
"NOT YET")))))))))))) AS Measure, IIf([Measure] In ('S104','S105'),1,
IIf([Measure] In ('S213','S214','S215','S216','S217','S218'),2,
IIf([Measure] In ('S181','S182'),3,0))) AS Tier, IIf([Measure] In
('S104','S105'),Format(76,"Currency"),
IIf([Measure] In ('S214','S215'),Format(95,"Currency"),
IIf([Measure] In ('S181','S182'),Format(132,"Currency"),
IIf([Measure] In ('S213'),Format(107,"Currency"),
IIf([Measure] In ('S216'),Format(71,"Currency"),
IIf(([Measure] In ('S217','S218') And
[Cooling]="A"),Format(71,"Currency"),0)))))) AS Rebate_Per_Ton INTO
acQUALIFIEDS
FROM acSAMPLE_APPLICATION AS tg;
if statement and when I do, along with the additional left ), I get a message
"Query too Complex..."
Is there a limit on the number of if statements Access2003 can handle?
Here is the query that works:
SELECT tg.ImportID, tg.App_ID, tg.Equipment_ID, tg.ItemID, tg.Manufacturer1,
Manufacturer2, tg.Model_No1, tg.BTUH, tg.System, tg.Product, tg.Cooling,
tg.EER, tg.SEER, tg.IPLV, tg.HighCOP, tg.LowCOP, tg.HSPF, tg.TXV, tg.ESTier,
tg.ESRebate_AmtH, tg.ESRebate_Per_Ton, ESApprove_FlagH, IIf(([Product]="AC"
Or [Product]="HP") And ([System]="S" Or [System]="P"),
IIF(([Cooling]="W" AND [EER]>=14 AND [BTUH] >=135000), "S213",
IIF(([Cooling]="W" AND [EER]>=14 AND [BTUH] <135000), "S216",
IIf([BTUH]>240000 AND [IPLV]>=10.4,"S218",
IIf(([BTUH]>=135000 And [BTUH]<=240000) AND [EER]>=10.8 AND
[IPLV]>=11.2,"S217",
IIf(([BTUH]>=65000 And [BTUH]<135000 AND [EER]>=11),"S216",
IIf(([BTUH]<65000 AND ( [EER]>=12 Or [SEER]>=14) And [TXV]=True) and
[Cooling]="A","S181",
IIf(([BTUH]<65000 AND ([EER]>=11.6 Or [SEER]>=14) And [System]="P" and
[Cooling]="A"),"S182",
IIf(([BTUH]<65000 AND (([EER]>=11.6 AND [EER]<12) Or ([SEER]>=13 AND
[SEER]<14)) And [TXV]=True),"S214",
IIf(([BTUH]<65000 AND (([EER]>=11.3 AND [EER]<11.6) Or ([SEER]>=13 AND
[SEER]<14)) And [System]="P" And [Cooling]="A"),"S215",
IIf(( [BTUH]<65000 AND [Cooling]="A" AND (([EER]>=11 AND [EER]<11.3) Or
([SEER]>=13)) And [System]="S" ),"S104",
IIf(([BTUH]<65000 AND ([EER]>=11 Or [SEER]>=12) And nz([SEER],0)<13 And
[System]="P" ) AND [Cooling]="A","S105",
"NOT YET")))))))))))) AS Measure, IIf([Measure] In ('S104','S105'),1,
IIf([Measure] In ('S213','S214','S215','S216','S217','S218'),2,
IIf([Measure] In ('S181','S182'),3,0))) AS Tier, IIf([Measure] In
('S104','S105'),Format(76,"Currency"),
IIf([Measure] In ('S214','S215'),Format(95,"Currency"),
IIf([Measure] In ('S181','S182'),Format(132,"Currency"),
IIf([Measure] In ('S213'),Format(107,"Currency"),
IIf([Measure] In ('S216'),Format(71,"Currency"),
IIf(([Measure] In ('S217','S218') And
[Cooling]="A"),Format(71,"Currency"),0)))))) AS Rebate_Per_Ton INTO
acQUALIFIEDS
FROM acSAMPLE_APPLICATION AS tg;