Hello Tom,
Long time listener, first time caller...
I have been working with vb code to automate a salary increase process
that not only rounds to the nearest penny but also rounds to the
nearest even penny using the code that follow. The problem I have is
that once I set the even rounded value back to the text field it adds
a 01 on the end of the raounded value (i.e. 1234.56 is 1234.5601)
I am hoping that there are some textbox.value properties that can be
modified to avoid this anomaly. FYI I have already set the textbox
decimal places to 2 with no avail.
Dim A As Single
Dim B As Single
Dim C As Integer
Dim D As Single
Dim NewSalary As String
'Calc percentage increase for new salary (Rounded to the nearest even
penny)
A = Me.txtCurrSalary.Value * ((Me.txtActPercent.Value / 100) + 1)
B = Int((A * 100) + 0.5) / 100
C = Int((B * 100) / 2) - ((B * 100) / 2)
D = (B - (C / 100))
Me.txtNewFinalSalary.Value = D
The following remarked lines included to display debug info.
'(i.e. me.txtCurrSalary.Value = 3220.52 & me.txtActPercent.value = 5)
'A = 3381.546
'B = 3381.55
'C = -1
'D = 3381.56
'me.txtNewFinalSalary.Value = 3381.5601 <:::::problem
Thanks for any assistance in advanced.
-Augustus
....Take me out with a screaming O tom!