Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Error using cint with large numbers

Posted on 2003-03-12
2
Medium Priority
?
647 Views
Last Modified: 2009-07-29
I am adding 2 values together.  One is from a database and one is not... ie.

    Total = Total + NewNumber

...which gives me a type mismatch error.  So I convert NewNumber to an integer, giving me this...

    Total = Total + cint(NewNumber)

This works fine unless the value of NewNumber is outside of the -32,768 to 32,767 range, which is very possible.  If that is the case I get this error...

    Overflow: 'cint'

I tried to use the int function instead of the cint function and get this wonderful error...

    "Variable uses an Automation type not supported in VBScript"

Any ideas out there on how I can add these 2 numbers together.

Thanks!
0
Comment
Question by:maysb
2 Comments
 
LVL 4

Accepted Solution

by:
CRagsdell earned 400 total points
ID: 8121441
Use CLng instead of CInt:

Total = CLng(Total) + CLng(NewNumber)


CLng converts to integers ranging from -2,147,483,648 to 2,147,483,647

CR
0
 

Author Comment

by:maysb
ID: 8121568
Perfect.  

Thanks!

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

571 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