Solved

overflow problem in vb6

Posted on 2013-11-15
5
339 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 26

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 500 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 26

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

912 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

15 Experts available now in Live!

Get 1:1 Help Now