I'm having a problem with this little app I created to print checks. I have a combo box with the limit to list set to yes. Sometimes I have a payee name that is only going to be used once so I don't want to add it to the list of payees but I can't get past the combobox. What am I doing wrong? Here's the code
Code:
Private Sub cmbPayeeList_NotInList(NewData As String, Response As Integer)
Dim tblPayee As DAO.Database
Dim rsPayee As DAO.Recordset
Dim intResp As Integer
Dim strMsg As String
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Confirm that the user wants to add the new customer.
Msg = "'" & NewData & "' is not in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbNo Then
' If the user chose not to add a customer, set the Response
' argument to suppress an error message and undo changes.
Response = acDataErrContinue
' Display a customized message.
Else
' If the user chose to add a new customer, open a recordset
' using the Customers table.
Set tblPayee = OpenDatabase("PayeeList")
Set rsPayee = tblPayee.OpenRecordset("tblPayee", dbOpenDynaset)
' Create a new record.
rsPayee.AddNew
rsPayee!strPayee = NewData
rsPayee.Update
' Set Response argument to indicate that new data is being added.
Response = acDataErrAdded
End If
Exit_CustomerID_NotInList:
Response = acDataErrContinue
Exit Sub
Err_CustomerID_NotInList:
' An unexpected error occurred, display the normal error message.
MsgBox Err.Description
' Set the Response argument to suppress an error message and undo
' changes.
Response = acDataErrContinue
End Sub