Possible to have 2 different formulas in one textbox's controlsource, user to choose the formula?

J

Jen

In a form where I have a calculated textfield, is it possible to let the
user choose between two ways how this field is calculated, from another
form/table field? That is, the user could select from another form which
formula to use, ie if he/she has the tax already included to the unitprice
or will the tax part of the unitprice be added to the unit price.
From another "settings form" the user would "globally" choose this to be
stored in the settings table. Based on this, the field would be calculated
accordingly. If the tax isn't already included in the unit price, and thus
should be added, the calculated form fields (=field showing the tax
"txtTax") controlsource would be "=[hours]*[hourlyrate]*[taxpercent]/100",
otherwise, If the tax is allready included in the unit price, and merely
would be shown as information, the controlsource for "txtTax" would be
"=([hours]*[hourlyrate])*(1-1/(1+([taxpercent]/100)))".

I tried to store the whole formula in the settings table and in the
calculated form fields controlsource point to this field, I also tried to
store the values 1 and 2, and with an If Then Else.. in the controlsource to
get the right formula/calculation, but without success.

Storing the whole formula could be a problem also because another calculated
field on the form (txtSumTotal) is calculated different depending on if tax
is allready in the unit price or not. If the tax is included in the unit
price, then the formula here would be "=([hours]*[hourlyrate])", and if the
tax isn't allready in the unit price then this formula should be
"=([hours]*[hourlyrate])+[tax]"


How could this be done, shifting the recordsources/ formulas of 2 calculated
textboxes on a form to different formulas depending on a value in a table
field (which the user has selected in the settings form)?

Jen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top