|
![]()
Runtime Error: 6 - OverflowThe obvious cause is when you do declare a variable and then try to store a number that is too large, as below:
This will cause an error on the last line, byt=lng. This is an obvious case - normally you will be trying to store the results of a calculation into the variable and it might not be so obvious as you are writing the code. If you use a consistent naming convention, such as the Leszynski/Reddick guidelines where you prefix variables with a tag indicating the variable type, this does help when you are writing the code. Another cause of this is caused by division, when both the numerator and denominator are 0 (if only the denominator is 0, then you get an error message of 11 - Division by Zero):
The final reason that you can get this error within Access is caused by multiplying two numbers together, such as Bytes, and trying to store them in a Long Integer field as you know that the result may be anything up to 65025. Access tries to assign the result of the operation to a Byte because both of the multipliers are permissible as Bytes:
The solution in this case is to convert at least one of the variables to the appropriate data type using something like CLng:
Copyright & Disclaimer | ||||||||||||||||
| Last modified at 06/06/2006 14:58:07 | |||||||||||||||||