will1128
09-20-2010, 01:43 PM
I'm trying to set this up such that if a user presses Tab or Enter and the text box is required and contains no data a MsgBox is displayed the focus of the cursor is set back to the text box.
My MsgBox is only displayed when I type into the text box, delete the typed text and then tab. If I press tab when nothing has been entered, nothing happens.
How do I make sure a user who is using my form has filled in all my required textboxes?
The code I have which does display the message box when I type and then delete text is.
Private Sub TextBox7_Change()
If Me.TextBox7.Text = "" Then
MsgBox "This is blank. Please Enter in."
End If
End Sub
My MsgBox is only displayed when I type into the text box, delete the typed text and then tab. If I press tab when nothing has been entered, nothing happens.
How do I make sure a user who is using my form has filled in all my required textboxes?
The code I have which does display the message box when I type and then delete text is.
Private Sub TextBox7_Change()
If Me.TextBox7.Text = "" Then
MsgBox "This is blank. Please Enter in."
End If
End Sub