Check combobox is not blank (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 07:07
Joined
Dec 1, 2014
Messages
401
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.
 

Ranman256

Well-known member
Local time
Today, 03:07
Joined
Apr 9, 2015
Messages
4,339
Combos are usually null,

If IsNull(cboBox) then
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:07
Joined
May 7, 2009
Messages
19,169
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

Top Bottom