# Thread: Building Calculation (2000)

1. ## Building Calculation (2000)

Hi,

We have two fields with possible fees in. One is a set fee and the other is a percentage. I have a field on the form called SellingFee which is the percentage and FixedFee which is the monetary value. There is a third field called Income which is to display the income used fromeach record. I want to have it so: -

Income = [SellingFee%] * [Price] or if sellingfee% is null then Income = FixedFee

How can I convert this into vba/access?

2. ## Re: Building Calculation (2000)

Thank you for explaining this to me, I understand where I was going wrong! As ever a great asset to the forum!

3. ## Re: Building Calculation (2000)

All I get in the text box, is #Name? after entering that Iff statment into the control source

4. ## Re: Building Calculation (2000)

Set the control source of the Income text box to
<code>
=IIf(IsNull([SellingFee%]),[FixedFee],[SellingFee%]*[Price])
</code>

The IIf function (Immediate If) can be used in expessions for conditional calculations. Its syntax is

IIf(Condition, Result_If_True, Result_If_False)

5. ## Re: Building Calculation (2000)

It should be <code><big>IIf</big></code>, not <code><big>Iff</big></code>.

Added: I had a typo in the expression too - I had <code>SelllingFee</code> instead of <code>SellingFee</code>. Now corrected. Sorry about that.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•