astarbyfar
Registered User.
- Local time
- Today, 06:38
- Joined
- Apr 27, 2003
- Messages
- 93
In a form Ive created I have data entry field that prompts the user to enter a figure which we will call tonnage. I then using the below code check to see if this number is valid i.e. whether it is above the recommended tonnage
Private Sub Tonnage2_BeforeUpdate(Cancel As Integer)
Recommended2 = (Press2Max * 0.8)
If Me.Tonnage2 > Recommended2 Then
If MsgBox("The tonnage exceeds the recommended tonnage. Do you wish to continue?", vbYesNo, "Exceeded tonnage") = vbNo Then Cancel = True
End If
End Sub
There is no problem with this. It works! However, in another case I need to do a sum of four user inputs which is calculated correctly by the form and then stores the result in a text box called Innertotal. The result in inner total must then be checked through the same procedure as above. Ive tried in all events using similar code to the above but still no luck. Cheers Mike
Private Sub Tonnage2_BeforeUpdate(Cancel As Integer)
Recommended2 = (Press2Max * 0.8)
If Me.Tonnage2 > Recommended2 Then
If MsgBox("The tonnage exceeds the recommended tonnage. Do you wish to continue?", vbYesNo, "Exceeded tonnage") = vbNo Then Cancel = True
End If
End Sub
There is no problem with this. It works! However, in another case I need to do a sum of four user inputs which is calculated correctly by the form and then stores the result in a text box called Innertotal. The result in inner total must then be checked through the same procedure as above. Ive tried in all events using similar code to the above but still no luck. Cheers Mike