jeffreybrown
Well-known Member
- Joined
- Jul 28, 2004
- Messages
- 5,152
Need a little help here...got stuck.
I'm checking all the textboxes on a userform for a null value which is working fine, but need to now exit the sub if one or more are null.
The code below gives the name of the textbox that is null, but even if everything is not null I still get the msgbox.
Any thoughts?
I'm checking all the textboxes on a userform for a null value which is working fine, but need to now exit the sub if one or more are null.
The code below gives the name of the textbox that is null, but even if everything is not null I still get the msgbox.
Any thoughts?
Code:
For Each ctrl In UserForm1.Controls
If TypeName(ctrl) = "TextBox" Then
If ctrl.Text = "" Then
txtAddress = txtAddress & ctrl.Name & " is empty" & vbNewLine
End If
End If
Next ctrl
MsgBox txtAddress, vbOKOnly, "Checking textboxes for no entry"