Hi All,
I have a simple userform and am struggling to find a way to make sure something is selected in the list box before the data is transferred to a table.
Here is one of the various things I have tried. For some reason the SelectedItem method isn't found and I get "method or data member not found". I have double checked this is indeed a list box, and the name is correct.
If ProductTypeComboBox.Value <> "Loegring" And Me.ModelListBox.SelectedItem Is Nothing Then
MsgBox "No Model Selected"
Exit Sub
End If
I also tried the SelectedItem = -1 version of the above.
Here is another one I tried, but it doesn't allow the Exit Sub to work properly
If ProductTypeComboBox.Value <> "Loegring" Then
For i = 0 To ModelListBox.ListCount - 1
If ModelListBox.Selected(i) Then j = j + 1
Next i
If j = 0 Then MsgBox "No Model Selected"
Exit Sub
End If
Any help is greatly appreciated, Thank you.
Bookmarks