How do you SUM two controls on a form

Clem

Registered User.
Local time
Today, 14:12
Joined
Mar 13, 2012
Messages
16
Help. I am trying to sum two controls on a form. The two controls are a column in a table as is the sum column. All three are on a form but I cannot get the sum figure to be calculated in the third control when the control get focus.:banghead:
 
on a textbox rowsource:

=sum([control1] + [control2])
 
Do you mean control source? I have tried that on Control source and the total control just puts the two numbers together, i.e if the value for Control 1 is 22 and the value for Control 2 is 23 the answer in the control which should sum the two values is 2223. !!
 
the total control just puts the two numbers together, i.e if the value for Control 1 is 22 and the value for Control 2 is 23 the answer in the control which should sum the two values is 2223. !!

That behavior suggest that the Fields that are bound to Control1 and Control2 are defined as Text, not as Numbers!

And the 'sum column' should not be included in a Table! This is a calculated Field and they should seldom be stored, but rather re-calculated, as needed!

Linq ;0)>
 
Thank you, you were right. The two numbers in Field 1& 2 now Sum correctly in the sum column. However another problem has arisen.

The form is a continuous form and when opened selects x number of records from two tables which are linked by a unique identifier.

Thus for each record there is a sum column. On the form the total in this column sums all the figures for all the records. i.e

If there are three records the results look like this

Record 1 - Field 1 (Data =10) Field 2 (Data = 4) Sum column total =33
Record 2 - Field 1 (Data = 5) Field 2 (Data =7) Sum column total = 33
Record 3 - Field 1 (Data = 4) Field 2 (Data = 3) Sum column total = 33

So the sum column is totaling all the field data for all the records

Grateful for any ideas on this one.
regards Clem
 
you are summing the entire dataset - the formulas only needs to be

=[control1] + [control2]
 
Thanks to all who have responded to this thread. Problem solved
 

Users who are viewing this thread

Back
Top Bottom