......

Dim a as long

a=69697 * 60

It works fine. Now I try this:

Dim a as long

a= 999 * 60

And I get an "overflow" error.......

Yes, I've seen this kind of problem before. It's a Basic "feature". You were lucky to get an overflow error whch tells you something was wrong. I tried the second one with QuickBASIC 4.5, and got a negative result.

The first one works because 69697 is greater than an integer and is treated as the next higher precision above integer.

The second one won't work because both 999 and 60 are integers, BUT the product of the two of them will not fit into an integer. The compiler doesn't look ahead to see that the result is going to be assigned to a long variable. All it knows is that it was given two integers to multiply where the result doesn't fit into an integer. So it just does the best that it can, which in this case is not what we expect.

When using explicit values like this, the safest way is to do one of the following methods:

1) Append the type (%,& ! #) that corresponds to the varable type of the result to each explicit value.

Dim a as long

a= 999& * 60&

2) Create a variable using DIM with the type that corresponds to the result of the expression where it will be used, and then set this variable to the value.

Dim a as long

Dim v1 as long

Dim v2 as long

v1 = 999

v2 = 60

a= v1 * v2

*****