Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i run Calculated controls if data is true/false

Status
Not open for further replies.

Ouch

Programmer
Jul 17, 2001
159
GB
i have a form based on a table
in the form you can click check boxes to say whether to add insurance (10%of total) or not and another checkbox to add vat(17.5% of total)or not as the case may be.
the controlsource for the checkboxes is data held in the table

i can get the calculations to work no problem but how do i make the calculations on the form add up only if the tick box is true or not is the tickbox is false.

i can get it to work by saving the calculation results in the table but there must be a better way
 
Try this . . .

Create a new field in your table named "grandtotal"

Create a query based on that Table and reflect your form to be based off the query now instead of the table.

Now go into the query and in your "grandtotal" field try something like this . . .

grandtotal: Abs(nz([calculatedfield1])+nz([calculatedfield2]))

I am not exactly sure what you are trying to add up, but if you look at the line above, what this does is adds the fields "calculatedfield1" and "calculatedfield2" and gathers that information and uses it for "grandtotal" . . . now I can place "grandtotal" on a form and I will have my SUM of those 2 calculated fields.

The part about check=true and check=false for your checkboxes only adding something if the checkbox is checked should not apply, just add all the fields you want, and if there is nothing in the field, it just wont add it.

Good Luck
Chance~
 
i've tried this but what fields gets added up depands on the check boxes on my form.

eq
i have 6 calculations
[Hirecost] (= sum of equipmentcosts on subform)
[Insurance] (= [Total Hirecost] *10%)only if ckbx=True
[Staff Cost] (= sum of StaffCosts on subform)
[Net Total] (= [Hirecost]+[Insurance]+[StaffCost])
[VAT] (= [Net Total]*[TaxRate])only if ckbx=True

i have three checkboxes

1 charge ( if = no [grand total] = £0)
2 Add Insurance ( if = no [Insurance] = £0)
3 Add VAT ( if = no [VAT] = £0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top