T
Tony Williams
I have a form where the user inputs a series of figures into a number of
controls. After they've input the total (they don't want the program to
create the total) there is a check to make sure the total of the controls
equals the totals they've input. Here is the code in the Before Update
property:
Private Sub txtAdvTot_BeforeUpdate(Cancel As Integer)
If ([txtAdv0] + [txtAdv500] + [txtAdv1000] + [txtAdv5000] + [txtAdv10000] +
[txtAdv50000] + [txtAdv100000]) <> [txtAdvTot] Then
If MsgBox(" Column 1 does not add up" & vbCrLf & "It should be " & [txtAdv0]
+ [txtAdv500] + [txtAdv1000] + [txtAdv5000] + [txtAdv10000] + [txtAdv50000]
+ [txtAdv100000] & " - Do you want to accept the error?", vbYesNo,
"Calculation Error") = vbNo Then
Cancel = True
End If
End If
End Sub
However in certain cases, and there is no pattern I can assure you, the
message box pops up and says that the total is wrong and repeats the total
that the user has input, in other words it isn't wrong. We've manually added
up all the controls to check that the total is correct and it is. This is
happening in about 3 out 15 cases. What can be causing this it's driving us
MAD!
TIA
Tony Williams
controls. After they've input the total (they don't want the program to
create the total) there is a check to make sure the total of the controls
equals the totals they've input. Here is the code in the Before Update
property:
Private Sub txtAdvTot_BeforeUpdate(Cancel As Integer)
If ([txtAdv0] + [txtAdv500] + [txtAdv1000] + [txtAdv5000] + [txtAdv10000] +
[txtAdv50000] + [txtAdv100000]) <> [txtAdvTot] Then
If MsgBox(" Column 1 does not add up" & vbCrLf & "It should be " & [txtAdv0]
+ [txtAdv500] + [txtAdv1000] + [txtAdv5000] + [txtAdv10000] + [txtAdv50000]
+ [txtAdv100000] & " - Do you want to accept the error?", vbYesNo,
"Calculation Error") = vbNo Then
Cancel = True
End If
End If
End Sub
However in certain cases, and there is no pattern I can assure you, the
message box pops up and says that the total is wrong and repeats the total
that the user has input, in other words it isn't wrong. We've manually added
up all the controls to check that the total is correct and it is. This is
happening in about 3 out 15 cases. What can be causing this it's driving us
MAD!
TIA
Tony Williams