Really Easy Question

jonnymenthol

Registered User.
Local time
Today, 20:18
Joined
Oct 31, 2001
Messages
58
Hello,

apologies for the easy question, but I just can't figure it out.

To cut a long story short, I have a simple form with boxA and boxB

both of these boxes give me a numer between 1 and 10.

I have another box (boxC) and have added in the code :

boxC = boxA + boxB

I'd expect, if A = 10 and B = 1, then boxC would give me 11, but it doesn't - it gives me 101.
 
A value in a textbox is treated as a string.

If I had two text boxes like you had but rather than 10 and 1 as values I had "John" & "Smith"

then:

John + Smith = JohnSmith

This is what is happening with your textboxes.

10 + 1 = 101

To get round this you can use the Val() function.

boxC = Val(boxA) + Val(boxB)
 
Thanks Mile - that worked a treat.

Cheers.
 

Users who are viewing this thread

Back
Top Bottom