I have a form with a ComboBox and a button. when the button is clicked, it's event should check that ComboBox has a value before proceeding. ComboBox has a default value set:
- Name=cmbName,
- Default Value = "Joe",
- RowSource=
SELECT name FROM table ORDER BY name;
This is what I tried:
Private Sub btnOk_Click()
If (CmbName.ListIndex = -1)Then
Exit Sub
End If
'Do Something
End Sub
But every time I click the button, cmbName.ListIndex
does equal -1, and the sub is exited even though there is a default value.