Replacing 'NotInList' Message for a Combo

  • Thread starter Thread starter Duncs
  • Start date Start date
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
 
"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 ------
 
"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!
 
Back
Top