In article <bt**********@ctb-nnrp2.saix.net>, "AA" <Al***********@hotmail.com>
writes:
Hi
I Have a till program that must round the change to the nearest 5cent
Ex. Amout tendered $130.00 Total owed R125.36 Change $4.64 The 4.64cents
must now be rounded up to the nearest 5cent namely $4.65
Any idea how to do this ?
Thanks
Alfred
Alfred
The small function below rounds up to the nearest 5 cents:
Public Function fRound5Cent(curAmount As Currency) As Currency
On Error GoTo E_Handle
If Int(curAmount / 0.05) = (curAmount / 0.05) Then
fRound5Cent = curAmount
Else
fRound5Cent = (Int(curAmount / 0.05) + 1) * 0.05
End If
fExit:
On Error Resume Next
Exit Function
E_Handle:
MsgBox Err.Description & vbCrLf & "fRound5Cent", vbOKOnly + vbCritical,
"Error: " & Err.Number
Resume fExit
End Function
--
Jon
www.applecore99.com - Access Tips and Tricks