View Full Version : Solved: Overflow Error #6
Kindly_Kaela
02-07-2007, 11:57 AM
I am trying to add several data fields from SQL and input it into Excel.
I ran this command inside the SQL loop to get the total.
Dim NRC_Total As Integer
Begin Loop
' SQL Code to grab a field
NRC_Total = NRC_Total + Current_SQL_Field
Loop
About 30 rows in, it popped that OVERFLOW error. Any suggestions?
Thanks!
Kaela
:cloud9:
Bob Phillips
02-07-2007, 12:00 PM
Maybe too many characters, how big is the string?
Norie
02-07-2007, 12:01 PM
Dim as Long not Integer.
mdmackillop
02-07-2007, 12:02 PM
It appears there is no exit from the loop. Try something like
Do
' SQL Code to grab a field
If Current_SQL_Field = "" Then Exit Do
NRC_Total = NRC_Total + Current_SQL_Field
Loop
Ken Puls
02-07-2007, 12:03 PM
Hi Kaela,
Is the value of NRC_Total going over 32,767? That's the max an integer can hold. You may want to try changing the data type to Long to go further.
Also, I assume that you do have more code in the loop? (Such as a way to exit it?)
HTH,
Kindly_Kaela
02-07-2007, 12:04 PM
I can't get over how fast you all reply! You all are the BEST!
Dim NRC_Total As Long
Yay! Worked perfect!
Sorry MD, I was just trying to summarize what I did. The loop works, I'm just too lazy to type it out. Next time I will.
- Kaela
:beerchug:
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.