Showing trailing zeros

  • Thread starter Thread starter CurtainMary
  • Start date Start date
C

CurtainMary

I have a table with a column containing upper limit values (numbers)
When I enter 0.10 as an upper limit, any retrieval through queries, reports
etc. always returns the value 0.1
If I specify 2 decimals, all values show two decimals.
In analytical chemistry these have different meanings
0.10 implies an accuracy +/- 0.01
0.1 implies an accuarcy of +/- 0.1
Can anyone help?
Thank you
 
I have a table with a column containing upper limit values (numbers)
When I enter 0.10 as an upper limit, any retrieval through queries, reports
etc. always returns the value 0.1
If I specify 2 decimals, all values show two decimals.
In analytical chemistry these have different meanings
0.10 implies an accuracy +/- 0.01
0.1 implies an accuarcy of +/- 0.1
Can anyone help?
Thank you

There's really no good way to do this in a Number field. As far as Access
internal storage is concerned, 0.10 and 0.1 and 0.1000000000 are exactly, bit
for bit identical. It will be stored internally in a binary format, not as
Arabic numbers.

You can store the value in a Text field large enough to store all the digits
you need, and use the Val() function to convert the string to a numeric value
for calculations; or you can use two fields, one to store the value and the
other the precision.
 
Thank you for replying, I will give it a go

KenSheridan via AccessMonster.com said:
One way to handle this would be to include another column, Accuracy say, of
text data type in the table, in which you can enter the format string for
whatever accuracy you want for the value in that row, so for an accuracy of
+/- 0.01 you'd enter an Accuracy value of 0.00, for an accuracy of +/- 0.1,
you'd enter 0.0. In both cases the actual UpperLimit value is 0.1.

In a query you can then return the value to the relevant accuracy, indicated
in the conventional way by the number of decimal places, with:

SELECT Format(UpperLimits.UpperLimit, Accuracy) AS UpperLimit
FROM UpperLimits
ORDER BY UpperLimit;

where UpperLimits is the table name and UpperLimit the column in which the
numeric values are entered. Note that if you wish to use the same name as
the column in the table for the column heading of the computed column in the
query you must qualify the column name with the table name in the expression.

Note that the Format function returns a string expression so if you wish to
sort the values, do so on the original value as I've done in the above
example.

You could do similarly with a computed control in a form or report of course,
though in that case the control name would have to differ from the original
column name to avoid a circular reference.

Ken Sheridan
Stafford, England


--
Message posted via AccessMonster.com


.
 
Thank you for replying, I will try this.

John W. Vinson said:
There's really no good way to do this in a Number field. As far as Access
internal storage is concerned, 0.10 and 0.1 and 0.1000000000 are exactly, bit
for bit identical. It will be stored internally in a binary format, not as
Arabic numbers.

You can store the value in a Text field large enough to store all the digits
you need, and use the Val() function to convert the string to a numeric value
for calculations; or you can use two fields, one to store the value and the
other the precision.
 
Back
Top