I have a form in which i have textboxes. When a user goes out of a textbox, i check if it is empty or has spaces and if so, want to return focus to this textbox. I have put the check in textbox_exit event. It cheks fine, gives the message but does not return focus to the textbox, focus goes to the next item in tab sequence. Any suggestions how to get it to do this would be appreciated. Here's my code
Private Sub txtCatNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Temp1
Temp1 = Trim(txtCatNo)
If Temp1 = "" Then
MsgBox ("Cannot leave value blank, Please enter a valid catalog number"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
txtCatNo = ""
txtCatNo.SetFocus
End If
End Sub
Private Sub txtCatNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Temp1
Temp1 = Trim(txtCatNo)
If Temp1 = "" Then
MsgBox ("Cannot leave value blank, Please enter a valid catalog number"
txtCatNo = ""
txtCatNo.SetFocus
End If
End Sub