Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding Currencies

Status
Not open for further replies.

Bigsteve42

Technical User
Nov 12, 2002
13
GB
Really need help on this one have went through previous solutions but can't seem to find one I need. I have two currency fields [AnnualPrem] and [DepositPrem] the on exit event for [AnnualPrem] is
Me![DepositPrem] = Me[AnnualPrem] *1.1

However I need to round the [DepositPrem] to the nearest £10
Any ideas would be greatly appreciated. Have only just started using Access so in dummy terms would be good.

Thanks
 
for GENERAL purpose rounding,

Code:
Function basMRound(Number As Double, Multiple As Double)

    'Usage: ? basMRound (132.3614, 0.7)
            ' 132.3

    'Set up variables
    Dim dblDivided As Double
    Dim intDivided As Integer


    dblDivided = Number / Multiple      ''Divide

    intDivided = Int(dblDivided)        'Integerise

    intDivided = Round(dblDivided, 0)   'Round

    'Return result, returning to nearest multiple
    basMRound = intDivided * Multiple

End Function
MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top