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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top