Access keeps rounding down... Decimal

W

WDSnews

Now I'm trying the table directly rather than using the form and I get the
same result. I've opened the table in design mode and tried every "Format".
I tried General, Currency, and fixed with 2 decimal places.

In table design, the Data Type is Number.
The field size is Decimal.
The format is.... well I've tried them all.

When I type 16.95 in a table column, it rounds to 16. Why? How do I fix
it?
 
J

John W. Vinson

Now I'm trying the table directly rather than using the form and I get the
same result. I've opened the table in design mode and tried every "Format".
I tried General, Currency, and fixed with 2 decimal places.

In table design, the Data Type is Number.
The field size is Decimal.

View the field's Properties. A Decimal number has two relevant properties -
the Precision, default 18, the number of digits available; and the Scale,
default 0, the number of digits after the decmal point.

Change the Scale to 2 and you should be OK.

The Format merely controls how the number is *displayed*, not what's stored.
 
W

WDSnews

hmmmm. That Worked. well, Thank you!

I'm slowly converting to Access from ObjectPal. I really don't understand
what 'scale' does. I don't understand why the decimal format and 2 decimal
places doesn't work, but scale 2 does.

thanks for your help.
 
J

John W. Vinson

hmmmm. That Worked. well, Thank you!

I'm slowly converting to Access from ObjectPal. I really don't understand
what 'scale' does. I don't understand why the decimal format and 2 decimal
places doesn't work, but scale 2 does.

It's sort of the same sense of the word as in a "scale model". I don't think
it's stored internally in this way, but you can imagine storing 18 digits as
just a big 10^18 number. If you scale it by 100 (10^2) then it goes from
100000000000000000 to 1000000000000000.00. You just scale it down by two
powers of ten.
 
B

BruceM

Actually, the OP said the field size was decimal, which does allow for
decimal values, so the problem is not with the field size, but rather
another property of the field, as has been pointed out.
 
K

kate

"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> a écrit dans le
message de groupe de discussion :
(e-mail address removed)...
 

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