decimals

N

northstar

I inherited table data already entered where the numerical value was rounded
and it needs to be set for 2 decimals. I have changed the field type to
"double" and set the decimals to "2". This works for all new entry but does
not convert old data. Is there any way to convert the old data to 2 decimals,
e.g. 2.13?
 
J

Jeff Boyce

The "double" data type is stored, I believe, as a binary value. There are,
ocassionally, "rounding" issues because of this.

If you will only ever need no more than 4 decimal places, consider changing
that to a "currency" data type.

Are you certain the difference you are seeing between "old" and "new" values
isn't being caused the the format that's being applied?

Where are you seeing the "old" formatting? In a form? Does the definition
of that form specific the format of those fields?

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John W. Vinson

I inherited table data already entered where the numerical value was rounded
and it needs to be set for 2 decimals. I have changed the field type to
"double" and set the decimals to "2". This works for all new entry but does
not convert old data. Is there any way to convert the old data to 2 decimals,
e.g. 2.13?

What's in the field now? If it's 2.00, how on Earth could Access tell whether
you want 2.0, or 2.13, or 2.99?
 
N

northstar

Jeff, The data is in a table. The original data was into a field formatted
for integer, although the actual values entered were in decimals, e.g. 1.5
and 2.3. When I change the field properties I get decimals in the new data I
enter, but display of the old data does not change. I was hoping Access
behaved like Excel in the matter of decimal/rounding memory; I guess it is
not.
 
N

northstar

I was hoping the original, acutal entry, although rounded up/down, was stored
and retrievable. By your reply, obviously not.
 
J

John W. Vinson

I was hoping the original, acutal entry, although rounded up/down, was stored
and retrievable. By your reply, obviously not.

Well, it might be. Don't confuse data STORAGE with data FORMAT. They're
different! Unlike Excel, Access has strong defined datatypes. If you have a
Long Integer field, it *is a long integer*, a whole number, and you can't
store decimal values in it; if you have a Double or Decimal or Currency
datatype, it will allow storage of decimals (up to four for a Currency field).

However the field's Format need not match. You can format a Long Integer field
with "#.0000" as a format string; it will always display four zeros after the
decimal point. You can also format a Double with a format suppressing
decimals, or set the decimal places property to zero; it will display as a
whole number *concealing the fractional value stored in the field*, even
though it's still there (and will show up in calculations).

So if your original actual entry was stored in a datatype supporting decimals,
all you need to do is change the Format. That's not clear from what you've
posted.
 
H

hor vannara

northstar said:
I inherited table data already entered where the numerical value was
rounded
and it needs to be set for 2 decimals. I have changed the field type to
"double" and set the decimals to "2". This works for all new entry but
does
not convert old data. Is there any way to convert the old data to 2
decimals,
e.g. 2.13?
 

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