Totaling Values in Custom Fields

Posted on 2003-12-01
Medium Priority
Last Modified: 2010-04-08
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.
Question by:Lorenzog0917
1 Comment
LVL 19

Accepted Solution

Dexstar earned 500 total points
ID: 9851913

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

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

Hope That Helps,

Featured Post

Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Let us take a look at the scenario, you have a database that is corrupt and you run the ESEUTIL command only to find you are unable to repair it. How do you now get the data back?
If there is anything erroneous with Exchange Database, it causes a significant effect on email communication till the user remounts the database. Further, database crash directly affects Outlook users due to which they are unable to access their ema…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question