Adding text boxes in form

Mark0123

Registered User.
Local time
Today, 08:42
Joined
Feb 13, 2015
Messages
10
Hi All,

I hope this is going to be quite an easy solution, but it has well and truly stumped me.

I am trying to sum the row in a access form. There are 3 text boxed called TXT1, TXT2, TXT3. I have added an additional text box and typed the following txt;

=([TXT1]+[TXT2]+[TXT3])

Instead of totalling the row it just puts the number together. For example TXT1 contains 1. TXT2 contains 2, and TXT3 contains 3 so the answer should be 6 (1+2+3) but it shows 123. I have tried putting SUM in front but that gives me the total of the whole column not just that row.

I hope this makes sense. You help is greatly appreciated.
 
I feel this is because of the fact they are being treated as Strings as opposed to Numbers. Try Casting them as numbers and try again.
Code:
=(CLng([TXT1]) + CLng([TXT2]) + CLng([TXT3]))
 
works perfectly.

Thank you very much for your help.
 

Users who are viewing this thread

Back
Top Bottom