Number Reverts to Zero

S

Sara

I have a form with a subform in it. When I open the form in Form View and
enter a number into a field on my subform, it reverts to 0. I checked the
table it is in and it's set as "Long Integer". I've tried changing the format
of the field to General Number, 0.0000, #.####, and I've tried it blank. I
tried making an input mask of both 0.0000 and #.####.

I get separate results based on what I've done. Here are the combos I've
tried:

Format: General Number & None
Decimal Places: 4 & Auto
Input Mask: None & #.####
Result: Anything less than 1 (i.e. 0.3545) reverts to 0 and anything over 1
(i.e. 1.3545) reverts to 1

Format: None, 0.0000, & General Number
Decimal Places: 4 & Auto
Input Mask: 0.0000 & #.####
Result:Anything less than 1 (i.e. 0.3545) reverts to 0.0000 and anything
over 1 (i.e. 1.3545) reverts to 1.0000

I have fields in the parent form that are set to Format: 0.0000, Decimal
Place: Auto, Input Mask: None and they work fine.

Any help would be greatly appreciated.
 
J

Jerry Whittle

An integer data type, by definition, doesn't have decimals. That includes
Byte, Integer, and Long Integer data types. Therefore Access rounds off the
decimals when they are entered.

Try changing the field to a Double data type.
 
J

Jeff Boyce

Sara

Jerry & Chris offer approaches if you need more than four decimal places.
You will find "rounding errors" if you use Single or Double datatypes. If
you need no more than four places, consider using "Currency" datatype (no
dollar-signs required...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

cdinha 40

Sara said:
I have a form with a subform in it. When I open the form in Form View and
enter a number into a field on my subform, it reverts to 0. I checked the
table it is in and it's set as "Long Integer". I've tried changing the
format
of the field to General Number, 0.0000, #.####, and I've tried it blank. I
tried making an input mask of both 0.0000 and #.####.

I get separate results based on what I've done. Here are the combos I've
tried:

Format: General Number & None
Decimal Places: 4 & Auto
Input Mask: None & #.####
Result: Anything less than 1 (i.e. 0.3545) reverts to 0 and anything over
1
(i.e. 1.3545) reverts to 1

Format: None, 0.0000, & General Number
Decimal Places: 4 & Auto
Input Mask: 0.0000 & #.####
Result:Anything less than 1 (i.e. 0.3545) reverts to 0.0000 and anything
over 1 (i.e. 1.3545) reverts to 1.0000

I have fields in the parent form that are set to Format: 0.0000, Decimal
Place: Auto, Input Mask: None and they work fine.

Any help would be greatly appreciated.
 

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