Addition

bionicman

Registered User.
Local time
Yesterday, 18:53
Joined
Jul 22, 2003
Messages
145
I have something weird happening on my form... i can't give a good example because i don't know what is causing it, sometimes when i try to add 2 text boxes, it combines them instead of adding the values.

for example

Text1 = 10
Text2 = 10
Total = 1010 (instead of 20)

it only happens sometimes, does anyone have any idea why? or how i can stop this?

Thank you,
 
An alternate use of the plus (+) sign is concatenation. Therefore, if one or both of the variables being combined is text, they will be concatenated rather than added. Only if both are numeric data types will they be added. That leads me to believe that you are attempting to "add" text fields and Access is interpreting this as a request to concatenate them.
 
correct... thank you VERY much!
 
So, how do you get these fields to add the numbers instead of concatenation?

In the original example above, he stated both text boxes were the number 10. Am I not understanding something from this example?

Thanks!
 
You can't do arithmetic on text fields. Convert them to the correct numeric data type.

CLng(txt1) + CLng(txt2) = numeric result as long as both fields acually are numeric. If they are not, you will get an error.

txt1 + txt2 = concatenation
 

Users who are viewing this thread

Back
Top Bottom