[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

overflow problem in vb6

Posted on 2013-11-15
5
Medium Priority
?
364 Views
Last Modified: 2013-11-15
i have a counter to track how many times program has run:
declared like this:
Public gTotalRuns As Long
In the sub
70        gTotalRuns = gTotalRuns + 1

gives the error::
Overflow
line 70
gTotalRuns = 32,768
How can i fix this?
0
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:Shaun Kline
ID: 39651529
You would need to change your variable declaration from Integer to Long.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 39651555
Have you accidentally left a local declaration in the Sub, like this?
Public gTotalRuns As Long

Sub MySub()
    Dim gTotalRuns As Integer

    '...
    gTotalRuns = gTotalRuns + 1
    '...
End Sub

Open in new window

0
 

Author Comment

by:isnoend2001
ID: 39651556
It already is
 Public gTotalRuns As Long
0
 
LVL 27

Expert Comment

by:Shaun Kline
ID: 39651576
You may have to cast the 1 to a long.

gTotalRuns = gTotalRuns + CLng(1)

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 39651609
Thanks you got me looking closer and I had an integer value on the next line
I was looking at the wrong line number(I Think)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 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