user7631583
user7631583

Reputation:

How to Sum value of fields in a ms access form

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

Answers (3)

Carlos Arturo Bellido
Carlos Arturo Bellido

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

mbizup
mbizup

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

Kostas K.
Kostas K.

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

Related Questions