Solved

Adding Big Numbers in VB6

Posted on 2014-12-04
4
104 Views
Last Modified: 2014-12-04
I amm getting an overflow on this line of code:

RelayParts(3, i) = sngStartTime + CLng(RelayParts(6, i))    'first skier...time they started

The array is variant because it contains multiple data types.  sngStartTime = 55947 and CLng(RelayParts(6, i)) = 600

What can  I do differently?
0
Comment
Question by:Bob Schneider
4 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 167 total points
ID: 40481861
Declare sngStartTime  as CLng
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 167 total points
ID: 40481884
Dim x As Long

x = Relayparts(6, i) '600

Relayparts(3, i) = sngStartTime + x   'first skier...time they started

Open in new window

0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 166 total points
ID: 40481900
You need, at least, to be aware of the limits of the declared data types  in the arithmetic expression. There are also limits to the value of intermediate calculations.

Firstly, what type is the Relay() declaration?
0
 

Author Comment

by:Bob Schneider
ID: 40481948
THat was the mistake.  I accidentally had the array type as integer.  My bad.
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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code 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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

867 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

19 Experts available now in Live!

Get 1:1 Help Now