I am extremely new to VBA and am trying to something that one would think would be easy. All I need is a way to create a stop in a form when a wrong entry is input. The form consists of hours per day, and three different areas where these hours are distributed. I have this code:
*
*
... that says after the last project's hours are entered it is compared to the total hours worked. Although the message box works, I need it to go back to the last entry and force the user to re-enter BEFORE moving on. I've tried GoTo, Undo, and looking up On Error statements - NOTHING works! Any ideas?
*
*
Code:
Private Sub Text1470_AfterUpdate() Me.Text1474.Value = (Text1470 / HOURSMondayTotal) If Val([Text1467]) + Val([Text1469]) + Val([Text1470]) > Val(HOURSMondayTotal) Then MsgBox "Hours for each well combined cannot exceed total hours for day, please re-enter" End If If Val([Text1467]) + Val([Text1469]) + Val([Text1470]) < Val(HOURSMondayTotal) Then MsgBox "Hours for each well combined must at least add up to the Total Hours Worked for the day, please re-enter" End If End Sub
... that says after the last project's hours are entered it is compared to the total hours worked. Although the message box works, I need it to go back to the last entry and force the user to re-enter BEFORE moving on. I've tried GoTo, Undo, and looking up On Error statements - NOTHING works! Any ideas?
*
Comment