Can't seem to quit Access from rounding numbers

  • Thread starter Thread starter Runningman
  • Start date Start date
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
 
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.
 
Long Integer data type holds only whole numbers. Change the data type to
Number and select Single or Double as the Field Size.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top