Change field value question??

  • Thread starter Thread starter gary
  • Start date Start date
G

gary

Hi,

How to change the field value like this in a query, only keep 2 decimal
place,

846550.005 >>> 846550
846550.012 >>> 846550.01
845550.057 >>> 846550.05

Thank!!
 
Hi,

Try No = Round(No,2)

In some early versions of access Round is not available therefore add the
following as a module and it should work.

Function Round(dblNumber As Double, intDecimals As Integer) As Double
On Error Resume Next
'-- Rounds a number to a specified number of decimal
'-- places. 0.5 is rounded up

Dim dblFactor As Double
Dim dblTemp As Double

dblFactor = 10 ^ intDecimals
dblTemp = dblNumber * dblFactor + 0.5
Round = Int(dblTemp) / dblFactor

End Function

Regards

Trev
 
gary said:
How to change the field value like this in a query, only keep 2 decimal
place,

846550.005 >>> 846550
846550.012 >>> 846550.01
845550.057 >>> 846550.05

Which rounding algorithm? Always round down? Always round towards zero (i.e.
consider negative values)? Symmetric truncation? Asymmetric truncation?

Jamie.

--
 
Back
Top