Decimal Precision in Access 2000

A

Al

Hello,
I created a database (MDB) to record Cricket Statistics, but unfortunately,
all my numbers that are decimals are rounded. The field is set to Decimal
and the decimal precision is 2, but all my numbers are rounded to the
nearest whole number.

(e-mail address removed)
 
A

Allen Browne

If you open your table in design view, and select this field, the data type
is shown as Number, and in the lower pane you have these properties:
Field Size Decimal
Precision 2

What that means is that you have defined a field that has only 2 significant
places, which is probably why it is rounding. Try increasing Precision to a
larger number, and setting the Scale property to 2 so that it has 2 digits
to the right of the decimal place.

Realistically, though, the Decimal is the worst, most incomplete, slowest
performing, and most bug-ridden numeric data type you could choose in
Access. One example:
http://members.iinet.net.au/~allenbrowne/bug-08.html

Could you use a Currency type field? It still gives you the benefit of a
fixed-point number, and provided you Round() any results to 2 places before
storing, you will never have summation errors.
 
J

John Vinson

Hello,
I created a database (MDB) to record Cricket Statistics, but unfortunately,
all my numbers that are decimals are rounded. The field is set to Decimal
and the decimal precision is 2, but all my numbers are rounded to the
nearest whole number.

Doublecheck the datatype. Is it in fact Decimal, as opposed to the
default Long Integer? You might want to use Currency instead of any
Number type - Currency is a scaled huge integer with exactly four
decimals and no roundoff error.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
A

Al

Thanks, this works!

Allen Browne said:
If you open your table in design view, and select this field, the data
type is shown as Number, and in the lower pane you have these properties:
Field Size Decimal
Precision 2

What that means is that you have defined a field that has only 2
significant places, which is probably why it is rounding. Try increasing
Precision to a larger number, and setting the Scale property to 2 so that
it has 2 digits to the right of the decimal place.

Realistically, though, the Decimal is the worst, most incomplete, slowest
performing, and most bug-ridden numeric data type you could choose in
Access. One example:
http://members.iinet.net.au/~allenbrowne/bug-08.html

Could you use a Currency type field? It still gives you the benefit of a
fixed-point number, and provided you Round() any results to 2 places
before storing, you will never have summation errors.
 

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