• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Totaling Values in Custom Fields

Using code, I am having a challenge totaling numbers from 5 different fields and displaying the total in a totals field. When I the following for example:
txtotal = txtNum1 + txtnum2 + txtNum3 + txtNum4 + txtNum5
Let's say that each field is hold the numbers 1 2 3 4 5 respectfully.
The result is 12345. It is concatinating the numbers instead of summing them up.
any ideas on how to do this in code.
0
Lorenzog0917
Asked:
Lorenzog0917
1 Solution
 
DexstarCommented:
@Lorenzog0917:

> txtotal = txtNum1 + txtnum2 + txtNum3 + txtNum4 + txtNum5

Try this:
     txTotal = CLng(txtNum1) + CLng(txtNum2) + CLng(txtNum3) + CLng(txtNum4) + CLng(txtNum5)

Hope That Helps,
Dex*
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now