Combo box error customisation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have 2 combo boxes on a form. When the user inputs something that is not
in the list, error 2237 is generated (what you have entered is not in the
list... please select an item in the list.) In the form's On error event, I
have changed this message to a custom message in user friendly language
relevant to the first combo.

However, if the user makes the same error in the second combo, of course the
same error is generated and the user is greeted with a message relating to
the first combo. Is there any way I can trap the error generated at the
"combo" level rather than at the form level, and display a relevant error
relating to that specific combo?

TIA
Rich
 
Use the property 'On Not in List' of each combo box and put your own Message
and then set response = 0.
e.g.
Private Sub Combo1_NotInList(NewData As String, Response As Integer)
MsgBox "First combo box message"
Response = 0
End Sub

Private Sub Combo2_NotInList(NewData As String, Response As Integer)
MsgBox "Second combo box message"
Response = 0
End Sub
 
Back
Top