Sum Calculations on forms

Killdozer

Registered User.
Local time
Yesterday, 20:32
Joined
Jan 17, 2009
Messages
21
My form has several text boxes with calculations, they work fine, but how do I calculate the total or sum of all my text boxes?

Killdozer:(
 
You include the names of the source textboxes in an expression in the control source of the target textbox.
So if you have textboxes tbSubtotal and tbTaxes on a form, you can add them in the tbTotal textbox by setting its control source to ...
Code:
=tbSubtotal+tbTaxes
... and it will display the result of this expression.
 
Sorry Lagbolt, for not making myself clear, and for taking so long to get back to you. But my problem is to get the sum from my text box with the calculation expression. For ex if textbox1=[Qty]*[Price], and I have several line items. I want to use another textbox to show the sum of texbox1. I tried " Textbox2=[sum textbox1]" but that doesn't work. What expression should i use to get the total for all items of textbox1. This form is in the datasheet view.
Killdozer
 
Lagbolt appears to be off duty. You can't sum a calculated control. Try

=Sum([Qty]*[Price])
 
Thanks pbaldy, that works, if I only had those two fields, but my actual calculation on my textbox is:
=([Todate]-[Fromdate]+1)*[Rental Fees]*[Quanity]
I tried this expression: =sum(([Todate]-[Fromdate]+1)*[Rental Fees]*[Quanity])
The problem is with the date calculation, as I tried that alone being:
=sum([Todate]-[Fromdate]) still get error return
 
Make sure you don't have a control (textbox, etc) with the same name as either of the fields, which can cause errors.
 
That was it, it now works. So my next questions is, this form will be one of 3 subforms on the main Form. So on the main form, can I put in a calculation to total all the subforms totals.
 
Thanks alot Paul, I think I got it, I will continue tomorrow

Phil
 

Users who are viewing this thread

Back
Top Bottom