I don't believe access provides a RoundUp function like Excel.
I developed a function some time ago which is similar in functionality, I call it RoundItUp:
==============
Function roundItUp(num As Double, dig As Integer)
Dim nmb, dg, mult
if dig<=0 then
msgbox "The decimal places to be rounded must be greater than 0",vbokonly,"Error"
exit function
end if
If num = 0 Then
roundItUp = 0
Else
If (num < 0) Then
mult = -1
Else
mult = 1
End If
nmb = Abs(num)
dg = dig
nmb = nmb * 10 ^ dg
If (Abs(num) * (10 ^ (dig + 1))) Mod 10 = 0 Then
nmb = Fix(nmb)
Else
nmb = Fix(nmb) + 1
End If
roundItUp = (nmb / (10 ^ dg)) * mult
End If
End Function
==================
Limitations:
This function will 'roundup' negative numbers as well as positive numbers. However, unlike RoundUp, it will not calculate properly with negative numbers in the 'dig' spot. 'dig' must be greater than 0.
Additionally, if the number has no decimal digits or if 'dig' is greater than the number of decimal digits in the number, the number returned will be the number itself. Of course, use at your own risk.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.