thread702-1559904
Good afternoon. I am having an issue very much like (perhaps the same) as in the referenced thread.
My form has 'yes' or 'no' option buttons in a frame. If the user checks the 'no' button, focus is sent to a text box (me.MER_Comments) where the user has to enter comments. If the user tries to leave the comments text box without entering something, I want the form to force the focus back to that text box.
Here's my code:
I tried putting this in the BeforeUpdate event, as suggested in the original thread, but I get the same result. No message box and the focus moves on to whatever was selected next. If I put the code in the LostFocus event, I get the message box, but the focus doesn't stay in the comments text box.
Thank you in advance for guiding me to the correct path.
Good afternoon. I am having an issue very much like (perhaps the same) as in the referenced thread.
My form has 'yes' or 'no' option buttons in a frame. If the user checks the 'no' button, focus is sent to a text box (me.MER_Comments) where the user has to enter comments. If the user tries to leave the comments text box without entering something, I want the form to force the focus back to that text box.
Here's my code:
Code:
If Me.Frame_Primary_MER.Value = 2 Then
If IsNull(Me.MER_Comments.Value) Then
MsgBox "Please enter your comments.", , "Explanation"
Cancel = True
Me.MER_Comments.SetFocus
End If
End If
I tried putting this in the BeforeUpdate event, as suggested in the original thread, but I get the same result. No message box and the focus moves on to whatever was selected next. If I put the code in the LostFocus event, I get the message box, but the focus doesn't stay in the comments text box.
Thank you in advance for guiding me to the correct path.