front end: Visual Basic 6.0

Dim intAmount as integer
intamount = val(txtamount.text)

Back end: AS/400 db2
library: CPALLIB
field: amount
type: Numeric
Len: 9
Decimal: 2

value: 100000


The problem is that when i insert new record to my database for this field: (amount), the value is 100000. it returns runtime error -6 overflow.

Please help me..

The Integer data type is a 16-bit number which can range from -32768 to 32767.

You need to use Long data type which is a 32-bit number which can range from -2,147,483,648 to 2,147,483,647. Long variables can only contain non-fractional integer values. You need to use Long variables over Integers for increased performance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.