Nesting IIf Statements

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a calculating field in a make table query that utilises the following
IIf statement.

SD: IIf([PolType]="10" Or [PolType]="11" Or [Poltype]="27" Or [Poltype]="28"
Or [PolType]="19",DLookUp("[SD]","[TblCharges]","[Class] =" &
[PolType]),[Premium]*DLookUp("[SD]","[TblCharges]","[Class] =" &
[PolType])/100)

I now have other options in the true part of the statement.

What I am trying to say is
On the true side
If [PolType] = "10" and [Poltype] = "endorsment" (and so on for the other
poltypes)then do 1 calculation
Else [if Poltype] = 10 and [Poltype] = "something else" (and son on for the
other poltypes) then do a different calculation

On the false side the IIf statement is same the same as above.
 
I would never create an expression in a query that is this complex. It looks
like you have some business calculations that should be performed by a
function in a standard module. This is a lot less messy, is re-usable, can
be found to modify, and better documented.
 
Back
Top