Solved

overflow problem in vb6

Posted on 2013-11-15
5
333 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
  • 2
  • 2
5 Comments
 
LVL 25

Expert Comment

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

Accepted Solution

by:
GrahamSkan earned 500 total points
Comment Utility
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
Comment Utility
It already is
 Public gTotalRuns As Long
0
 
LVL 25

Expert Comment

by:Shaun Kline
Comment Utility
You may have to cast the 1 to a long.

gTotalRuns = gTotalRuns + CLng(1)

Open in new window

0
 

Author Closing Comment

by:isnoend2001
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now