Replacing 'NotInList' Message for a Combo


D

Duncs

Hi folks.

I have an unbound combo on my form, where the user types in an account
number. If the value they enter is not in the list, I want to show a
message alerting them to this. I don't want them to have the option
to add a new entry, I just want the warning box to be displayed. So,
I have the NotInList event as follows:

Private Sub cboContractAccount_NotInList(NewData As String, Response
As Integer)

MsgBox vbCrLf & " There is no record matching" & vbCrLf & _
" for that CRN.", vbExclamation, "No Match"

End Sub

This works fine, except for the fact that it also displays the default
Access message "The text you entered isn't an item in the list." Can
I override / supress this message?

TIA

Duncs
 
Ad

Advertisements

D

Dirk Goldgar

"Duncs" wrote in message
Hi folks.

I have an unbound combo on my form, where the user types in an account
number. If the value they enter is not in the list, I want to show a
message alerting them to this. I don't want them to have the option
to add a new entry, I just want the warning box to be displayed. So,
I have the NotInList event as follows:

Private Sub cboContractAccount_NotInList(NewData As String, Response
As Integer)

MsgBox vbCrLf & " There is no record matching" & vbCrLf & _
" for that CRN.", vbExclamation, "No Match"

End Sub

This works fine, except for the fact that it also displays the default
Access message "The text you entered isn't an item in the list." Can
I override / supress this message?

That's what the Response argument is for. Set it to acDataErrContinue:

'------ start of code ------
Private Sub cboContractAccount_NotInList( _
NewData As String, Response As Integer)

MsgBox vbCrLf & " There is no record matching" & vbCrLf & _
" for that CRN.", vbExclamation, "No Match"

Response = acDataErrContinue

End Sub
'------ end of code ------
 
Ad

Advertisements

D

Duncs

"Duncs"  wrote in message












That's what the Response argument is for.  Set it to acDataErrContinue:

'------ start of code ------
Private Sub cboContractAccount_NotInList( _
                        NewData As String, Response As Integer)

    MsgBox vbCrLf & "  There is no record matching" & vbCrLf & _
        "       for that CRN.", vbExclamation, "No Match"

    Response = acDataErrContinue

End Sub
'------ end of code ------

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)- Hide quoted text -

- Show quoted text -

Doh!
 

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