SetFocus question

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
 
S

ShaneDevenshire

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top