Hey, I am in school and learning VB6. I have run into a problem that I can't seem to solcve. I need to make sure all the fields are filled in before the user can process with the command button. I thought it would work if I just put an if stat in the lostfocus command of that text field. I have to set the focus back to that field so the user can fill it in. When I have 2 or more fields the message box that I have coming up just keeps coming up and does not go away until I end task on the prog. Any thoughts? Here is the code I am unsing:
Private Sub txtName_LostFocus()
If txtName = "" Then 'check to see if it's filled
strBox = MsgBox("Please fill in the name field.", vbOKOnly, "Empty Field"
txtName.SetFocus
intCheck = 1 'set check to 1 to allow cmd visable
Else
intCheck = 0
End If
End Sub
The code works fine if I don't set the focus back to txtName....
Thanks for any thoughts!
Private Sub txtName_LostFocus()
If txtName = "" Then 'check to see if it's filled
strBox = MsgBox("Please fill in the name field.", vbOKOnly, "Empty Field"
txtName.SetFocus
intCheck = 1 'set check to 1 to allow cmd visable
Else
intCheck = 0
End If
End Sub
The code works fine if I don't set the focus back to txtName....
Thanks for any thoughts!