Overflow error

Overflow error

Post by Jay Franci » Thu, 06 Mar 1997 04:00:00



Tell me why I get an overflow error using this code:

Private Sub Command1_Click()
Dim Entry As Double
Dim Result As Double
Entry = Val(Text1.Text)
Result = Entry / (1000 * 1000)
End Sub

But no overflow error using this code:
Private Sub Command1_Click()
Dim Entry As Double
Dim Result As Double
Entry = Val(Text1.Text)
Result = Entry / (1000000)
End Sub

Thanks for taking your time to read this.
--
Jay Francis
Nebraska Game and Parks Commission
2200 North 33rd
Lincoln, Nebraska 68503

(402)471-5589

 
 
 

Overflow error

Post by Joe Garri » Tue, 11 Mar 1997 04:00:00



>Tell me why I get an overflow error using this code:

>Private Sub Command1_Click()
>Dim Entry As Double
>Dim Result As Double
>Entry = Val(Text1.Text)
>Result = Entry / (1000 * 1000)
>End Sub

I'd guess that VB is interpreting the two 1000's as integers and
thus attempting to do integer math on them. You could do:
Result = Entry / (CDbl(1000) * CDbl(1000))
...might help.

Joe

Never underestimate the power of a WAG.

http://www.citilink.com/~jgarrick/vbasic/

 
 
 

1. Arithmetic overflow Error when retriving @@Identity


Arithmetic overflow occurred.

Ex:
INSERT INTO  X (Y) VALUE ('Y')


The record still gets inserted but I get an error when trying to retrieve the identity column.
this only happens when I'm calling a procedure from another procedure and not from ISQL

Any help or hints would be appreciated.


2. CLOBS via OO4O in VB6

3. Arithmetic overflow error converting numeric to data type numeric

4. TPMS?

5. Overflow Error Opening Recordset

6. 21776 - DBO not found in user collection

7. Overflow error when exporting data

8. Security

9. Arithmetic overflow error on 2000 SP2

10. Arithmetic Overflow Error

11. data overflow error

12. Overflow error trying to connect to SQL2K

13. sp_monitor arithmetic overflow error