Calculated field from a combo box

qurn

Registered User.
Local time
Today, 12:24
Joined
May 2, 2005
Messages
63
I'm trying to get some equations to work for a database involving ski lifts.If I can get it to work right it should give me the resulting tension on the lift.
I have a two combo boxes that contains two values, counterweight and Hydralic, the other one has the values extends cylinder and retracts cylinder.

if counterweight is selected it should calulate the value with the equation
([L/bore]*[w/Rod]*[D/quan]*145+[additionalweight])/[counterweightparts]

If Hydralic and extends cylinder is selected it should calculate it with
(3.14*[L/bore]^2)/(4*[D/quan]*[additionalweight])

If Hydralic and retracts cylinder is selected it should calculate it with
(3.14*([L/bore]^2-[W/Rod]^2))/(4*[D/quan]*[additionalweight])

I'm trying to get this to work using IIF statements in a query but I can't seem to get it right.

I hope I was clear enough in my explanation. If any body know how to get this to work or nows a better way of going about it please help, Thanks.
 
Assuming that your problem is with the Iif() not the calculation :)

Tension: IIf([Forms]![MyForm]![Cbo1]="counterweight",([L/bore]*[w/Rod]*[D/quan]*145+[additionalweight])/[counterweightparts],IIf([Forms]![MyForm]![Cbo2]="extends cylinder",(3.14*[L/bore]^2)/(4*[D/quan]*[additionalweight])
,(3.14*([L/bore]^2-[W/Rod]^2))/(4*[D/quan]*[additionalweight])
))

HTH

Peter
 
Thanks Peter
It's still giving me trouble like it can't handle Zero's in the additional weight colomn, even when counter weight is selected. when thething does give me a number it doesn't come up with one that any of the eqations should give me.
:confused:
 
Last edited:
I would check the calculations individualy then to try to work out the problem. just stick each one in its own column and see what happens.

Peter
 
Thanks again Peter, I shoulda thought of that. Ok, I ran them all through the equations, and found out that it's always running through the last equation.
 
Whats the source for the combobox?

Peter
 
a column in a table, it should be
![Lift Info]![Type], and
![Lift Info]![Pressure does what?]. I try to use that but it keeps on asking for the values. Fortuately these colomns are also in my queries so I can use [Type] and [Pressure does what?] and it does not ask for the values.

Of course I did not chose the names of the colomns they are chosen by my boss.
 
I suspect then that the if's is using [Pressure does what] instead of [Type].
try changing the values around to see what happens.
Also if you create a new column in the query
MyCbo:[Forms]![MyForm]![Cbo1]
It will show you what the combo is returning

Peter
 

Users who are viewing this thread

Back
Top Bottom