Checking for selection in combo box

  • Thread starter Thread starter Andy G
  • Start date Start date
A

Andy G

What is the best way to check that a combo box has a selected value? I need
my clients to select a value first and then click a button. Before they
click the button I need to check if they have selected anything in the combo
box.

Thanks.
 
in message:
What is the best way to check that a combo box has a selected value? I need
my clients to select a value first and then click a button. Before they
click the button I need to check if they have selected anything in the combo
box.

Something like so:

Private Sub cmdCheck_Click()
If IsNull(Me.cboMyComboBox) Then
' No value selected
MsgBox "Please select an item from the list provided " _
& "before continuing.", vbExclamation, "Select Value"
Me.cboMyComboBox.SetFocus
Else
' Value selected

' Do your other code here
End If
End Sub
 
Back
Top