J
John
The following code is supposed to check if something was
entered in the Phone Number textbox. If the box was
left empty, the user is supposed to get an error message
(this part works) when they attempt to go to the next
field and, after they click OK on the message box, the
focus should be set back on the Phone Number textbox.
For some reason the focus does not go back onto the Phone
Number textbox. I do not want the user to be able to leave
the text box till they enter in a value, is the setfocus
method the right method or should I be using something
else.
Thanks,
John
Private Sub txtPhoneNum_LostFocus()
txtPhoneNum.SetFocus
If Len(txtPhoneNum.Text) = 0 Then
MsgBox "You must enter the phone number!",
vbExclamation, "Insufficient Data"
txtPhoneNumber.SetFocus
End If
End Sub
entered in the Phone Number textbox. If the box was
left empty, the user is supposed to get an error message
(this part works) when they attempt to go to the next
field and, after they click OK on the message box, the
focus should be set back on the Phone Number textbox.
For some reason the focus does not go back onto the Phone
Number textbox. I do not want the user to be able to leave
the text box till they enter in a value, is the setfocus
method the right method or should I be using something
else.
Thanks,
John
Private Sub txtPhoneNum_LostFocus()
txtPhoneNum.SetFocus
If Len(txtPhoneNum.Text) = 0 Then
MsgBox "You must enter the phone number!",
vbExclamation, "Insufficient Data"
txtPhoneNumber.SetFocus
End If
End Sub