Can't seem to quit Access from rounding numbers

R

Runningman

As a test, I've created 2 fields in a new table, worked out the Field
Properties with "Long Integer, and Decimal Places=2." Obviously I'm missing
something as whenever I enter 10.25 the value comes back as 10. Is it
something that needs to be done in Visual Basic? That sounds really dumb but
I can't fix it!

Thanks in advance!

-R
 
L

Lou

As a test, I've created 2 fields in a new table, worked out the Field
Properties with "Long Integer, and Decimal Places=2."  Obviously I'm missing
something as whenever I enter 10.25 the value comes back as 10.  Is it
something that needs to be done in Visual Basic?  That sounds really dumb but
I can't fix it!

Thanks in advance!

-R

It's interesting that the field properties page allows this
contradiction. By specifying that a long integer can hold a
fractional number, you redefine the integer into a floating point
number.

Luckily, Access was not fooled by this trick and it still returned
only the whole number part of 10.25.
 
K

Ken Snell \(MVP\)

Long Integer data type holds only whole numbers. Change the data type to
Number and select Single or Double as the Field Size.
 
J

John W. Vinson

As a test, I've created 2 fields in a new table, worked out the Field
Properties with "Long Integer, and Decimal Places=2." Obviously I'm missing
something as whenever I enter 10.25 the value comes back as 10. Is it
something that needs to be done in Visual Basic? That sounds really dumb but
I can't fix it!

Thanks in advance!

-R

A Long Integer field is - by definition - an integer, a whole number. Whole
numbers do not accommodate fractions. The Decimal Places property is just for
display formatting (so you can see the number as 10.00 for example).

Solution: don't use a Long Integer if you need decimals. Use a Decimal, or a
Single, or a Double, or - perhaps best - don't use any Number datatype at all,
but rather a Currency field. The latter is a scaled huge integer with exactly
four decimals, no roundoff error, and a range into the trillions.
 
Top