format fixed with 3 decimal places so why do i see about 10 decimal places

rainbows

Registered User.
Local time
Today, 11:33
Joined
Apr 21, 2017
Messages
428
hi i am confused why i have fixed my field yet when i click on that field i see about 10 numbers yet the qty is only 0.010

1667064272890.png



this one below shows 0.000 in the qtyoutstanding which i should not see because the query say >0 for that feild . again when i click on it it shows

1667064636413.png




1667064698794.png

1667064773253.png
 
Formatting just controls how the data is displayed . It doesn't alter the actual values.
When you click on the record, you see the underlying data.

So for example 0.000215 is greater than zero and will be shown but will appear as 0.000 to 3 d.p.
 
Therefore, if you want to store only 3 decimal places, you need to round all calculations prior to saving the data. You can run an update query to round what you have so far but going forward, you have to modify code.
 
I prevent this sort of thing by having a set of standard Functions for each Variable Type.
Write a Function in a Module to set the decimal places of any field, i.e.: Valid_Double(Param as Variant, Decimals as byte) as Double

If the Param is non-numeric the function should return a zero. Then for each field in your report, screen or query pass the contents through it.

FieldName = Valid_Double(FieldName, 3)

You then don't care what the user tries to enter into the field, because the function will sort it out and there will not be anything there to affect any later calculations. Even if the user presses [DELETE] to leave a Null to be saved into your data, the function will handle and correct that as well as the decimals required.
 

Users who are viewing this thread

Back
Top Bottom