PDA

View Full Version : Check for Empty Controls in Userform



Ethan
09-22-2011, 10:52 AM
Hello all,

What code can I use to check if the textbox and combobox are empty or not?

Bob Phillips
09-22-2011, 11:10 AM
Len(TextBox.Text)

and

ComboBox1.ListCount = 0

Ethan
09-23-2011, 08:53 AM
Thank you for replying xld.

I solved it with the following code:


If Me.TextBox1.Value = "" Or Me.ComboBox1.Value = "" Then
MsgBox "Empty fields"
Exit Sub
End If