1 1 1 1 1 1 1 1 1 1 Rating 1.00 (1 Vote)

Problemstellung:

Für 32Bit und 64Bit Office Versionen

Wie kann ich unter Access mit bestimmen Anzahl von Dezimalstellen Runden? 

Function RoundIt(NumberToRound As Double, DecimalPlace As Integer) As Double
    Dim Temp As Double
    Temp = Int((NumberToRound * (10 ^ DecimalPlace)) + 0.5) / (10 ^ DecimalPlace)
    RoundIt = CDbl(Temp)
End Function 

Aufruf:

Dim x As Double
x = RoundIt(1317.4258, 3)


Ergebnis: x = 1317,426

Dim x As Double
x = RoundIt(1317.4258, 2)


Ergebnis: x = 1317,43

Dim x As Double
x = RoundIt(1317.4258, 1)


Ergebnis: x = 1317,4

Dim x As Double
x = RoundIt(1317.4258, 0)


Ergebnis: x = 1317

 

Ähnliche Artikel