Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numeric field overflow

Status
Not open for further replies.

chrsab

Programmer
May 24, 2002
44
GB
Hello

I have a program which searches excel files. One problem i am getting is the Run-Time Error '3349' : Numeric Field Overflow. This doesn't happen on all excel files even though the layouts of the excel files are the same.

Does anyone know why this is happening and maybe a possible answer to combating this?

Thanx
 
When does this error occur??

Can you show us the code you are using to search the Excel files??

Cheers

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
If you store values from a cell of the excel sheet eg 35000 and the variable is integer --> overflow
 
Yes i think that the values which is being stored is the problem. How would i correct this?
 
Dim the Variable as Long.

Hope this helps

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
or double or single
(double > single)


Dim cByte as Byte 'declare cByte as 1 byte numeric value ranging from 0 to 255. Used in bit/byte manipulations.
Dim Ip as Integer 'declares "Ip" as a numeric variable of 2 bytes whose values can range between -32768 to 32767
' use Integers for loop variables, counters and small table indexes.
Dim Lval as Long 'declares "Lval" as a whole number of 4 bytes with range between -2,147,483,648 to 2,147,483,647
' use Longs for indexes into large tables, file i/o, and other VB counters;
Dim Bucks as Currency 'declares "Bucks" as a numeric variable of 10 bytes with high calculation accuracy
' which ranges from -922,337,203,685,477.5808 to 922,337,203,685,477.5807.
' Use this data type for calculations involving money and fixed decimal point accuracy.
' Currency calculations are about as fast as longs.
Dim dontUse as Single 'declares "dontUse" as a single precision floating point variable.
' Use Double rather than Single except where demanded by VB/Windows API;
' Double is much more accurate and even runs about 10-20% faster than Single.
Dim Realone as Double 'declares "Realone" as a double precision floating point variable of 8 bytes which can range from
' -1.79769313486232E308 to -4.94065645841247E-324 for negative values;
' 4.94065645841247E-324 to 1.79769313486232E308 for positive values.
' Use when a numeric value can have several decimal places or range to extreme sizes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top