iholder said:
I would like to validate if the user made a valid selection from combo list
box.
If not a valid selection an error message.
If you can live with the fairly good default message, all
you have to do is set the combo box's LinitToList property
to Yes.
There are two ways to provide your own message along with
undoing the invalid entry. The recommended way is to set
the combo box's LimitToList property to Yes and use the
NotInList event with this kind of code in the event
procedure:
MsgBox "You must select an item from the list"
Me.Combo0.Undo
Response = acDataErrContinue
For completeness, the obscure way is to set the LimitToList
property to No and use the combo box's BeforeUpdate event:
If Me.Combo0.ListIndex = -1 Then
MsgBox "You must select an item from the list"
Me.Combo0.Undo
Cancel = True
End If