Combo box error customisation

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
 
G

Guest

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
 

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

Top