Reputation:
I have a form where in need to calculate sum of multiple text boxes. example: i have two text boxes A=10.15 and B= 15.60. I want to sum their values in text box 'c'. I tried using the sum function but results in '#Error' and '+' which appends the two values '10.1515.60'.
Any Suggestions??? Thank you
Upvotes: 0
Views: 20998
Reputation: 11
Tried this =Val[TextBoxA.value]+Val[TextBoxB.value]
it works, when I try to sum two textboxes in another textbox, at first Access concatenated the values but with this formula access let you sum both values.
Upvotes: 1
Reputation: 16
The SUM function is for totaling the values in the same field, across multiple records.
To calculate the total of two textboxes, set the Control Source property of textbox C to the following (include the = sign)
= NZ([A],0) + NZ([B],0)
The NZ function gracefully handles NULLS by changing them to 0.
Note that textbox C will be unbound, so the sum will not be stored in your table (but it is not a good practice to store calculations, so that should be OK).
Upvotes: 0
Reputation: 8508
Set the Control Source of textbox C (without the quotes).
'=[TextBoxA]+[TextBoxB]'
Make sure the textbox format is Number. Leaving it blank concatenates the values.
Upvotes: 0