Rounding

M

Melinda

I am writing a new compensatory time program in which I need to take the
existing balances provided by another program, I divide that figure by 1.5,
and that gives me the figure to put into the new program. So employees
have a balance sitting there of .25 that is waiting to be paid off, but when
I add the figure of .1666667 into the new compensatory program, I have that
field to multiply it by 1.5, the results I .20. I have moved the decimals
out to seven digits but that doesn't appear to be my problem. Any
suggestions
 
A

Arvin Meyer MVP

Access has a built in rounding function, starting with version 2002. If you
have an earlier version, here is a quick and dirty rounding function:

Function RoundN(X, N As Integer)
'
' Rounds a number to N decimal places
' Uses arithmatic rounding
' N should be in the range 0-10 for proper results
'
Dim Factor As Long
Factor = 10 ^ N
RoundN = Int(X * Factor + 0.5) / Factor
End Function
 
Top