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!

sum function in access form 1

Status
Not open for further replies.

SharonMee

MIS
May 7, 2004
210
CA
Hello All:

I have 4 text boxes in my Access form.

I created another box to add the values of these text boxes together (Total): right-clicked on my total text box, properties, data, control source and I built an expression as follows:

=[Jam]+[Pepper]+[Tomato]+[Cucumber]

However, say I put 20 in each of these text boxes, in my total text box I get: 20202020, instead I want to get 80 as my answer.

What am I doing incorrectly?

Thanks for helping.


SharonMee
 

Sharon,

Try the following:
=val([Jam])+val([Pepper])+val([Tomato])+val([Cucumber])

This will convert the strings to numbers.

hope this helps...
 
that's because it's concatenating the text together instead of adding the integer value of the text together. Maybe this will work?:

Code:
=Cint([Jam])+Cint([Pepper])+CInt([Tomato])+CInt([Cucumber])

Leslie
 
OK, I knew there was some function that would convert the text to it's value, just thought of the wrong one!



Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top