NotInList How to eliminate System Generated Error

Joined
Jun 28, 2005
Messages
2
Reaction score
0
I am using the following code. Everything works EXCEPT after the message I put in the code, I get the system generated message: "The item you selected is not in the list - Please select...." How do I eliminate that message??


I have LimitToList set to YES, and this code is in the NotInList property.



Option Compare Database
Option Explicit

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


If MsgBox("Do you want to add '" _
& NewData & "' to the list of contractors?", _
vbOKCancel, "Add New Item") = vbOK Then

' Remove new data from combo box so control can be requeried
' after the Form1 form is closed
DoCmd.RunCommand acCmdUndo

' Display form to collect data needed for the new record
DoCmd.OpenForm "Form1", acNormal, , , acAdd, acDialog, NewData

'Continue without displaying default error message.
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

End Sub

Thanks for your assistance in advance,
10SNUT
 

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