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
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