Don't want Access to round numbers to nearest integer.

G

Guest

I am building some tables and forms in Access, and my numeric fields are
rounding to the nearest integer. I have the table field defined as a Numeric
and Auto for decimal places. I have the text box on the form defined as a
fixed with two decimal places. However, if I type in 2.3453 it will round it
to 2.00 or if I enter 3.5 it rounds it to 4.00. How do I get the text box to
leave the value to accurately round the number to whatever decimal place I
have defined for the field?
 
D

Dirk Goldgar

In
Aaron said:
I am building some tables and forms in Access, and my numeric fields
are rounding to the nearest integer. I have the table field defined
as a Numeric and Auto for decimal places. I have the text box on the
form defined as a fixed with two decimal places. However, if I type
in 2.3453 it will round it to 2.00 or if I enter 3.5 it rounds it to
4.00. How do I get the text box to leave the value to accurately
round the number to whatever decimal place I have defined for the
field?

It sounds like the Field Size you've chosen for your field is Integer,
Long Integer, or Byte. These are all whole-number data types, and can't
hold decimal places no matter what format you pick. Change the field to
Single, Double, Currency, or Decimal, as appropriate for your use.
Single and Double are both floating-point types, which means they store
an imprecise representation of numbers, but their precision is high
enough for most purposes. If you need absolute precision to a certain
number of decimal places, you can use the Decimal type, but Access has
historically had a few quirks in handling fields of this type and I'm
not sure what the current status of the Decimal data type is.
 

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