IIF Function with dropdown box

Shooting Star

Registered User.
Local time
Today, 10:20
Joined
Dec 22, 2008
Messages
15
Hi,

I am making a database about carpets (don't ask why, lol). I have a dropdown box named 'Plywood Base?'. It has two columns; the first is yes and no, and the second is the price of yes is selected.

What I am aiming to achieve is something like this;

When yes is selected from the dropdown box, in another textbox I want it to show;

The price for yes (£3.99), multiplied by the area of the carpet (which is in another text box on the form), plus £20.

When no is selected from the dropdown box, I want the value to be just '0'.

I've tried achieving this by this IIF formula:

=IIf(([Plywood Base?].[Column](0))="Yes","=([Text132]+20)","0")

Textbox132 is a textbox on the form with the value of the area of carpet*£3.99.
However, this IIF formula isn't working for me.

Any ideas would be greatly appreciated!
 
On the after update of the combo box

Code:
If Me.Combo = "Yes" Then

   Me.Cost = (Val(Me.Combo.Column(1)) * Val(Me.TxtYardage)) + 20
Else
   Me.Cost = 0
End If
 
Thanks for your help! I'm sorry if this sounds really dumb, but I'm new to access and databases:

What does the 'me.' and 'yardage' mean/represent in the code?
 
Me. relates tells access to look for a control the active form be it a combo box or textbox. The Yardage is simply a name that is given to a control. in my example I used the phrase TxtYardage as something meaningful.
 

Users who are viewing this thread

Back
Top Bottom