Field Rounding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I suppose this should be obvious but how do you keep the input to a numeric field in a table from rounding to the nearest whole number?
 
Make sure the data type of the field allows numeric decimals. Several types
such as integer and long don't accept decimal values. Double, Single,
Currency, and Decimal will.

--
Duane Hookom
MS Access MVP


RAB said:
I suppose this should be obvious but how do you keep the input to a
numeric field in a table from rounding to the nearest whole number?
 
I suppose this should be obvious but how do you keep the input to a numeric field in a table from rounding to the nearest whole number?

The default type of Number is a "Long Integer" - which IS an integer,
that is, a whole number.

If you want decimals, either use a Float or Double number type (look
at the field properties at the bottom of the screen when you select
the field in table design), or use a Currency datatype rather than a
Number datatype. Float and Double do suffer from roundoff error;
Currency has exactly four decimals, no more and no fewer, but does not
have roundoff error.
 
The datatype for the table should not be "integer". Suggest that you set
format = Standard, 2 decimal places in controls related to this field.
 
This is from the help library

Rounds a number to a specified number of digits.

Syntax

ROUND(number,num_digits)

Number is the number you want to round.

Num_digits is the number of digits you want to round to.
Negative rounds to the left of the decimal point; 0 (zero)
rounds to the nearest integer.

_____________

ROUNDDOWN
Rounds a number down, toward 0 (zero).

If this function returns the #NAME? error value, you may
need to install msowcf.dll.

Syntax

ROUNDDOWN(number,num_digits)

Number is any real number that you want rounded down.

Num_digits is the number of digits you want to round to.
Negative rounds to the left of the decimal point; 0 (zero)
or omitted rounds to the nearest integer.
___________

ROUNDUP
Rounds a number up, away from 0 (zero).

If this function returns the #NAME? error value, you may
need to install msowcf.dll.

Syntax

ROUNDUP(number,num_digits)

Number is any real number that you want rounded up.

Num_digits is the number of digits you want to round to.
Negative rounds to the left of the decimal point; 0 (zero)
or omitted rounds to the nearest integer.

Jim
-----Original Message-----
I suppose this should be obvious but how do you keep the
input to a numeric field in a table from rounding to the
nearest whole number?
 
The datatype for the table should not be "integer". Suggest that you set
format = Standard, 2 decimal places in controls related to this field.

Just to make it clear, you'll *also* need to change the datatype from
the default Long Integer to Number/Single, Number/Double, or Currency.
Changing the Format or the decimal places on a Long Integer field
won't give it a fractional part!
 
Back
Top