Help with IIf

  • Thread starter Thread starter FrustratedAZ
  • Start date Start date
F

FrustratedAZ

Guest
I'm a newbie, and taking a class on Access.

I can't seem to get a IIf function to work for me.

What I need it to do is add $2 to a sum of two fields if one of the fields equals a value. But I also need the calculated field to add two fields together.

So far I have the two fields adding together, ( BillTotal: Sum([OrderAmt] +[DeliveryCharge]) )

How do I go about adding the IIf function to this same calculated field?

I tried doing the following, but it does not work: BillTotal: IIf (City="Naples", Sum([OrderAmt] + [DeliveryCharge] +2, Sum([OrderAmt] + [DeliveryCharge))

What should it be? :confused:
 
Access doesn't have a sum function for use the way you are trying to use it. Besides, when are are only two, maybe three things to add up, it's easy enough just to use the + operator.

Since you'll have the [OrderAmt] + [DeliveryCharge] part in there no matter what the outcome of the "if" part, we dont' need to include that twice.

Try this:
BillTotal: IIf(City="Naples",2,0) + [OrderAmt] + [DeliveryCharge]
 
(never mind...)

Doug.
 

Users who are viewing this thread

Back
Top Bottom