Hi All,
I am having some problem with this bit of code. I have a BeforeUpdate event that checks to see if a check box is checked. If the check box is checked and a textbox does not have any text then an error message is displayed letting the user know to enter a value. However, if the user unselects the check box (leaving the textbox blank) the beforeupdate will not allow the user to move to another record until the screen is refreshed... Any ideas on how to get this code to work correctly? Thanks,
jbehrne
If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
I am having some problem with this bit of code. I have a BeforeUpdate event that checks to see if a check box is checked. If the check box is checked and a textbox does not have any text then an error message is displayed letting the user know to enter a value. However, if the user unselects the check box (leaving the textbox blank) the beforeupdate will not allow the user to move to another record until the screen is refreshed... Any ideas on how to get this code to work correctly? Thanks,
jbehrne
Code:
Private Sub Form_BeforeUpdate(cancel As Integer)
Me.Check75.SetFocus
If (Me!Check75.Value = True) Then
Me!FSOrderNumber.SetFocus
If Trim(Me!FSWorkOrderNumber.Text) = "" Then
MsgBox "A valid MRO number is required.", vbOKOnly + vbCritical, "Missing Data - Enter MRO"
cancel = True
End If
Else
cancel = False
End If
End Sub
If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations