Decimal Point Problems

Miethr

Registered User.
Local time
Today, 17:40
Joined
Jul 6, 2006
Messages
33
I am working on a database that tracks things for a welding shop. Because of this I am using heights in millimeters and decimal points are necessary. The page I am using is an input form with a subform tied to a specific record. I can under no circumstance get my decimals to stay put in the input form or in the table. I have tried changing to decimal and putting the decimal to two and the precision to five, long integers with decimals to 2. Formatting with #.## so it maintains it in the text box... but nothing has worked. Has anyone run into this problem?

Thanks

Riley
 
Can you post a copy of your database so we can see what is happening
 
convert double to string and locate your decimal character. Based on your regional settings it's either a comma or a point or vica versa:D
Usually that's the problem.

HTH
 
Bit more clarity please. Do you want to record values to two decimal places? Eg 2,151.75mm

If so then you dont want an integer datatype at all, since that won't hold a decimal fraction. You need a double or a single. Assuming that this is user input, there shouldn't be a problem with rounding since this value will be input to two decimal places, I assume. I think then the issue is simply the formatting to two decimal places. You can apply the formatting in the table, but I prefer my data to be 'raw' in the table and apply the format in the form.
 
If you need to store decimals, you need to use either the datatype Currency or Numeric. For numeric, you need either the Field Size Single, Double or Decimal (for the latter, remember to set the scale, only applying formatting, doesn't make it store decimals). Byte, Integer and Long Integers do not store any decimals.

If you've used a "wrong" datatype when "dragging" the control to the form, it will often keep the original format/properties. The easiest, is probably to do delete the control from the form, then correct changes to in the table field, then "drag-n-drop" it to the form again. To be sure, you might want to test it in the tables datasheet view first.

For format, use for instance Standard, which comes with two decimals and thousand separator according to locale.

The datatype/field size determines whether or not you're able to store decimals, the format is just the visual appearance.
 
You try to put an immediate step before updating the field:

CLng([YourField]*100)/100
CInt([YouField]*100)/100

You make your value an Integer (not precision), then multiply it by 100 and finally divide by 100 back into its precision.

Simon
 
neileg is correct. Integers are WHOLE numbers, no decimals.
 

Users who are viewing this thread

Back
Top Bottom