Table field set to 2 decimals but more are showing

J

Johnny5

Wow, this one really has me stumped as it appears that Access is
breaking its own rules. I have a table with imported data (from a
..xls). An example of a value that I am importing is 8.453333333. Ok,
no problem. I set the field size to single with 2 decimal places in
the table. Now, looking at the table shows the same value
(8.453333333). Any query also shows 8.453333333. Double checked the
number of allowed decimal places on the "general" ab for the table and
it shows a field size of single and 2 decimal places. I want this to
return 8.45!


What gives!!!!!

Johnny,
 
A

Allen Browne

The Decimal Places setting affects only how the data is displayed, not how
it is stored.

You can force it to show just 2 places by setting the field's Format
property to Fixed (not General), and the Decimal Places to 2. But be aware
that the stored value does contain more places, so you can still get
rounding errors when totalling the column.

Single and Double are floating point numbers, and always subject to rounding
errors. The Currency type does not have this issue, as it is a fixed-point
number (always storing 4 decimal places.)

You could use an Update query to round the field to 2 places, and you would
then have no rounding errors - particularly if you used a Currency field.
 

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

Top