Number Field not showing zero's at the end of the number.

N

naiveprogrammer

I designed a table that has "job number" as a field but it's leaving off the
zero's. Ex) job number 55.2100 looks like 55.21. I have the field set up to
double & to allow 4 decimal places. Any ideas???
 
D

Douglas J Steele

Numeric data types are seldom a good choice if you need either leading or
trailing zeroes displayed: as numbers, 55.21, 00055.21 and 55.2100 are all
identical. As well, numeric fields are prone to floating point round-off
error: what you see as 55.2100 may, in fact, be stored as 55.20999999999,
which can lead to problems when checking for equality.

In general, unless you're going to be doing arithmetic on the values, it's
best to store them as text.

If you absolutely can't change the datatype to text, you can set a format of
#.0000 to ensure that 4 decimal points are always shown. Remember, though,
that formatting a number doesn't change its value: it's still going to be
prone to the round-off error I mentioned above.
 
W

Wayne Morgan

Allowing 4 decimals doesn't force it to display as 4 decimals if there are
fewer. You will need to format the field to show 4 decimals. If you've
already created controls on a form or report for this field, you'll need to
manually update those controls to show the formatting also. Set the format
property of the field to

#.0000
or
0.0000

The first one will display zero as .0000, the second one will display zero
as 0.0000.
 
J

John Vinson

I designed a table that has "job number" as a field but it's leaving off the
zero's. Ex) job number 55.2100 looks like 55.21. I have the field set up to
double & to allow 4 decimal places. Any ideas???

If you're using this field as an identifier, and you won't be doing
arithmatic with it - use a Text data type, not any sort of number.

John W. Vinson[MVP]
 
Top