How do I disable rounding.

G

Guest

I'm not quite sure how or why, but when I create a new table with a number
field it automatically rounds to the neareast whole number.

How do I disable the autorounding feature?
 
R

Rick Brandt

TomSibley said:
I'm not quite sure how or why, but when I create a new table with a
number field it automatically rounds to the neareast whole number.

How do I disable the autorounding feature?

You are probably using...

Data Type = Number
Field Size = Integer (or Long Integer)

Integers don't support fractions so they are rounded automatically. Change
the Field Size to Single or Double or change the Data Type to Currency.
 
J

John Vinson

I'm not quite sure how or why, but when I create a new table with a number
field it automatically rounds to the neareast whole number.

How do I disable the autorounding feature?

By choosing a different type of number. The default Number datatype is
a Long Integer - which is, by definition, a whole number.

If you need up to seven decimal places precision, look at the lower
left of the screen with the field selected and choose Single in the
Size box; Double will give you some 14 decimal places.

On the other hand, if this field is for money values or if you can get
by with four, exactly four no more no fewer, decimals - don't us
Number at all; use Currency as the datatype instead. This can be
better for some things since both Single and Double have "roundoff
error" - they're stored as approximations accurate to some seven and
fourteen decimal places respectively.

John W. Vinson[MVP]
 
P

peregenem

John said:
if this field is for money values or if you can get
by with four, exactly four no more no fewer, decimals - don't us
Number at all; use Currency as the datatype instead. This can be
better for some things since both Single and Double have "roundoff
error"

In the real (no pun, John <g>) world, very few attributes are genuinely
Single or Double, which are inexact data types. Instead, they are fixed
decimals and exact. Fortunately, Jet does now (i.e. since Access2000)
have a DECIMAL data type.

Yes, there is a bug associated with the DECIMAL type (sorting negative
values in descending order is wrong) but thre are workarounds (e.g.
sort in a recordset) and it isn't fatal - just as well because it is
the data type Access/Jet uses natively e.g. try

SELECT TYPENAME(987.0123456)

and it returns 'Decimal'.
 

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