Check combobox is not blank

chrisjames25

Registered User.
Local time
Today, 03:50
Joined
Dec 1, 2014
Messages
404
Hi

I currently use the following code to check if a textbox is blank when i click an enter command button:

Code:
    If Nz(Me.Txt_NewTier1, "") = "" Or Len(Trim(Me.Txt_NewTier1) & vbNullString) = 0 Then

     ' Enter message here
        Exit Sub
else
    End If

My question is is this the right way to test whether a combobox also isn't blank and has a valid entry.
 
Combos are usually null,

If IsNull(cboBox) then
 
Check its listidex, if -1 then the combo is blank or not in list

If Me.combo.listindex> -1 then
' value is valid
 

Users who are viewing this thread

Back
Top Bottom