Form is storing 0.5 as 0

  • Thread starter Rpt_Me4NotBeingSmart
  • Start date
R

Rpt_Me4NotBeingSmart

I have a combo box on my form with a value list of "1";"0.5", after selecting
"0.5" it ends up being "0". I have tried everything I can think of to fix it,
which is not much. Can anyone assist me please?
 
B

boblarson

What is the datatype that it is storing to? If it is either Integer or Long
Integer, change it as integers do not have decimal places.
 
D

Dirk Goldgar

Rpt_Me4NotBeingSmart said:
I have a combo box on my form with a value list of "1";"0.5", after
selecting
"0.5" it ends up being "0". I have tried everything I can think of to fix
it,
which is not much. Can anyone assist me please?


My guess is that the combo box is bound to a field that only stores whole
numbers: Long Integer, Integer, or Byte. Make sure in your table design
that the field is one of the types that can store decimal places: Single,
Double, Currency, or Decimal.
 
M

Maurice

You probably have the datatype to number - integer. This will round your
number to the nearest whole number downwards (so 0.5 will become 0 and 0.9
will also become 0). Set the fieldproperty to double. (in the table that is..)

hth
 
D

Dirk Goldgar

Maurice said:
You probably have the datatype to number - integer. This will round your
number to the nearest whole number downwards (so 0.5 will become 0 and 0.9
will also become 0).

Not necessarily downwards. 0.9 will not become 0, it will become 1. Access
uses "banker's rounding", which basically rounds up or down to the nearest
whole number, but when there is no "nearest" (e.g., .5 is halfway between 0
and 1) rounds even numbers down and odd numbers up to minimize the
cumulative effects of rounding error. That's not a very precise
description -- you can search the web for details.
 
R

Rpt_Me4NotBeingSmart

I did as suggested. I changed the table for the field to double. In the table
it is still storing as 0 but on my form itself it appears still as 0.5. I
opened,closed each a couple times to be sure it wasn't just me.
 
J

John... Visio MVP

Rpt_Me4NotBeingSmart said:
I did as suggested. I changed the table for the field to double. In the
table
it is still storing as 0 but on my form itself it appears still as 0.5. I
opened,closed each a couple times to be sure it wasn't just me.


Next thing to check is the display format in the table. The value may be
there, but not being displayed. How many decimal places is it set to
display?

John...
 
R

Rpt_Me4NotBeingSmart

You guys were a great deal of help. Thank you. It is fixed now. To be honest
I am not sure what one thing fized it, so thank you to all.
 
Top