Brendan Reynolds rounding module

W

Wayne-I-M

Hi

I have used a small module by Brendan Reynolds (thanks for this Brendan) to
convert some numbers to currency.
There are 1.35 million numbers so need to get it right - am working on a
copy of the DB, just in case.

People book a ski holiday and some of the costs they pay need to be
increased by 4.86%.
This means that some of the amounts are (for example) £10 = £10.486
I need to round these numbers to £10.48 (round "down" so people don't
complain)
So I have used the module below

Public Function CurRound(Amount As Currency) As Currency
Dim cur2Dec As Currency
Dim cur3Dec As Currency
Dim cur4Dec As Currency
cur4Dec = Amount
cur3Dec = CCur(Format(cur4Dec, "#.000"))
cur2Dec = CCur(Format(cur3Dec, "#.00"))
CurRound = cur2Dec
End Function

Slight problem - I have obviously got something worong :)

£10.486 becomes £10
I need £10.48

£38.637 becomes £39
I need £38.63

These amounts are used in "lots" of other querries, reports, etc so I can't
just format([amount],"Currency") as I need to really alter the amounts -
down to the nearest penny.

Any ideas on where I am going wrong would be good

Thank you
 
W

Wayne-I-M

Its OK - got this from the main MS website

TruncCC = Int (X * Factor) / Factor

Works fine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top