SetFocus question

  • Thread starter Thread starter Patrick C. Simonds
  • Start date Start date
P

Patrick C. Simonds

Can someone tell me why this code does not return the focus to TextBox7

If Len(PhoneNum) = 1 Then 'Checks for a correct amount of numbers
MsgBox "Please enter a correct Phone Number"
TextBox7.SetFocus
End If
 
Hi,

Your code must be on the userform code sheet. Here is a typical block of
code to handle an incorrect or missing entry:

IF Len(me.txtPhone) <7 then
Beep
MsgBox "That is not a legal phone number."
me.txtPhone=""
me.txtPhone.SetFocut
Exit Sub
End IF

This would be attached to the OK button of your userform in many cases.
 
Back
Top