funkyd77
Jan 10th, 2000, 06:00 PM
I had this problem today and had to use the prescribed work-around. This is from the msdn library:
You attempt to use a number in a calculation, and that number is coerced into an integer, but the result is larger than an integer. For example:
Dim x As Long
x = 2000 * 365 ' Error: Overflow
To work around this situation, type the number, like this:
Dim x As Long
x = CLng(2000) * 365
-------------
This seems a bit stupid. Can't visual basic tell that it's a Long integer. Why does this "coercing" happen. Sounds more like a glitch in the compiler to me. Does anyone know of a better work-around than the one microsoft prescribes?
Thanks in advance,
You attempt to use a number in a calculation, and that number is coerced into an integer, but the result is larger than an integer. For example:
Dim x As Long
x = 2000 * 365 ' Error: Overflow
To work around this situation, type the number, like this:
Dim x As Long
x = CLng(2000) * 365
-------------
This seems a bit stupid. Can't visual basic tell that it's a Long integer. Why does this "coercing" happen. Sounds more like a glitch in the compiler to me. Does anyone know of a better work-around than the one microsoft prescribes?
Thanks in advance,