View Full Version : won't show decimals


SueBK
05-30-2010, 08:01 PM
I'm using Access 2003.

I have a table; pretty basic to capture the number of hours personnel work in a given week.

The 'hours' field is given me the pip. Details of the field:
Data Type: number
Field size: long integer (although I've also tried integer and decimal)
Format: standard (although, again, I've also tried general number and fixed)
Decimal places: 2

I want to enter hours as a decimal amount; ie 1.5 hours not 90 minutes and not 1 hour 30 minutes. At the moment (regardless of which combination of the above formats I use) I can not get it to show me the 0.5 or 0.25 etc. If I type "11.5" I either get 12.00 or 11.00 (can't seem to see a pattern as to which way it rounds). So, it is showing the decimal places, but not their values.

Galaxiom
05-30-2010, 08:13 PM
Integer and Long Integer are ...well ...integers. Integers are whole numbers so can't have decimal places. The decimal places setting is ignored.

Decimal is a high precision format and must be set correctly to control the precision.

Use Single which is for real numbers. Really big numbers use Double.

PNGBill
05-30-2010, 08:16 PM
I had same problem with trying to get interest rates to fix at 2 dec places and used Double as field size, Fixed as Format and 2 decimal places

Galaxiom
05-30-2010, 08:44 PM
I had same problem with trying to get interest rates to fix at 2 dec places and used Double as field size, Fixed as Format and 2 decimal places

Unless you are a really nasty loan shark you shouldn't need Double for Interest Rates. Single will suffice for over a trillion trillion trillion percent (3.402823E38) :D

He is an explanation of data types:
http://bytes.com/topic/access/insights/601315-vba-data-types

If you are really concerned about precision division use Decimal.

PNGBill
05-30-2010, 09:00 PM
:o I just kept trying until I stumbled across one that worked.

Actually numbers on the RH side of the decimal are not as bad as the ones on the LH side:eek: