Not In List help needed

  • Thread starter Thread starter Tara
  • Start date Start date
T

Tara

I have the following code in a combo on my form:

Private Sub CboCustomer_NotInList(NewData As String, Response As Integer)
Dim strMsg As String

strMsg = "'" & NewData & "' is not currently in the list of businesses "
& vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add this business to the current list?"

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new business?") = vbYes Then
Response = acDataErrContinue

DoCmd.OpenForm "frmAddCustomer", , , , , acDialog
Response = acDataErrAdded

End If

End Sub

It works fine except for the fact that when I try to close frmAddCustomer,
my custom message repeats itself. If I choose No the 2nd time around (since
I JUST added the data), frmAddCustomer closes and the combo shows the new
data. Why does my message appear a 2nd time and how do I stop it?

Thanks!
 
Try taking out the line

Response = acDataErrContinue

and see if that makes a difference.

Carl Rapson
 
Back
Top