Overflow error

D

DSTDIVA3

I am receiving an overflow error when this line is executed...

varSource = Nz(rstExcelRS.Fields(strIndexName).Value, -1)

The values are retrieved from a spreadsheet. The code was working fine
until it reached the value 38387. There isn't any calculations, so what
could be the problem? Do I need to set varSource back to 0 each time?
 
G

George Nicholson

Any chance that varSource is declared as an Integer data type? If so, change
it to a Long (aka Long Integer) data type.
Assigning a value greater than 32,767 to an Integer variable will raise an
overflow error.

HTH,
 
M

Marshall Barton

DSTDIVA3 said:
I am receiving an overflow error when this line is executed...

varSource = Nz(rstExcelRS.Fields(strIndexName).Value, -1)

The values are retrieved from a spreadsheet. The code was working fine
until it reached the value 38387. There isn't any calculations, so what
could be the problem? Do I need to set varSource back to 0 each time?


What type is varSource declared as? If it's Integer, than
that would be the cause and you should change it to Long.
 
Top