# Working With Datasheet Formats In SubForms

N

#### nouveauricheinvestments

Hi,

I have a subform that allows a user to enter data. Most of these
fields have a Fixed number format set to 4 decimal places. When a
user enters a number and then moves to the next field, the cell rounds
the value replacing the decimal places with zero's. For example, if I
type in the cell the following: 1.3462, and then move to the next
field, it will replace 1.3462 with 1.0000. What can I do to fix
this?

R

#### Rick Brandt

Hi,

I have a subform that allows a user to enter data. Most of these fields
have a Fixed number format set to 4 decimal places. When a user enters
a number and then moves to the next field, the cell rounds the value
replacing the decimal places with zero's. For example, if I type in the
cell the following: 1.3462, and then move to the next field, it will
replace 1.3462 with 1.0000. What can I do to fix this?

Sounds like your field size has been set to Integer or Long Integer,
neither of which support decimals. You need to use a size of Single or
Double or else use a type of Currency or Decimal.

D

#### Dirk Goldgar

Hi,

I have a subform that allows a user to enter data. Most of these
fields have a Fixed number format set to 4 decimal places. When a
user enters a number and then moves to the next field, the cell rounds
the value replacing the decimal places with zero's. For example, if I
type in the cell the following: 1.3462, and then move to the next
field, it will replace 1.3462 with 1.0000. What can I do to fix
this?

I think maybe the field in question has one of the integer types: Long
Integer, Integer, or Byte. These are all integer (= whole number) data
types, and by definition can't store any decimal places at all. Check the
Field Size property of the field in the table's design view to see what
subtype of Number the field is.

What sort of data are you storing in the field? For most purposes, one of
the floating-point types, Single or Double, is suitable. But for financial
data, which must be precise, you would normally use the Currency data type
(which can hold up to four decimal places) or the Decimal data type (for
which you can specify the exact precision and scale you need.

N

#### nouveauricheinvestments

I think maybe the field in question has one of the integer types: Long
Integer, Integer, or Byte. These are all integer (= whole number) data
types, and by definition can't store any decimal places at all. Check the
Field Size property of the field in the table's design view to see what
subtype of Number the field is.

What sort of data are you storing in the field? For most purposes, one of
the floating-point types, Single or Double, is suitable. But for financial
data, which must be precise, you would normally use the Currency data type
(which can hold up to four decimal places) or the Decimal data type (for
which you can specify the exact precision and scale you need.

The user will be entering prices. These prices might be in the form
of the Yen, GBP, or about 20 other currencies. Some will have 4
decimal places and will not be larger than, say, 5. Others will have
2 decimal places and not be larger than, say, 200.

N

#### nouveauricheinvestments

The user will be entering prices. These prices might be in the form
of the Yen, GBP, or about 20 other currencies. Some will have 4
decimal places and will not be larger than, say, 5. Others will have
2 decimal places and not be larger than, say, 200.

Perfect. It turned out I needed to change a few things. I have listed
them below:

1. I changed the size to 'Decimal'
2. I changed the Format to 'Currency'
3. The big thing - I changed the Scale to '4'. The scale was
originally at 0 and that is why it was not holding decimal values.

D

#### Dirk Goldgar

Perfect. It turned out I needed to change a few things. I have listed
them below:

1. I changed the size to 'Decimal'
2. I changed the Format to 'Currency'
3. The big thing - I changed the Scale to '4'. The scale was
originally at 0 and that is why it was not holding decimal values.

From the sound of it, I think I would have been using the Currency data type
(which is different from the Currency format). The Currency data type is
intended for currency values, so long as you don't need more than 4 decimal
places.