Tring to use following NotinList code. Receiving error "type missmatch", but the table Servides has 2 columns: No (autonumber) and ServiceName (text):
Private Sub Service_NotInList(NewData As String, Response As Integer)
Dim Db As Database
Dim Rs As Recordset
Dim Msg As String
On Error GoTo Err_CustomerID_NotInList
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Confirm that the user wants to add the new customer.
Set Db = CurrentDb
Set Rs = Db.OpenRecordset("Services", dbOpenTable)
' Create a new record.
Rs.AddNew
' Assign the NewID to the CustomerID field.
' Rs![Full name] = NewID
' Assign the NewData argument to the CompanyName field.
Rs![ServiceName] = NewData
' Assign the NewID to the CustomerID field.
'Rs![Country] = NewID1
' Save the record.
Rs.Update
' Set Response argument to indicate that new data is being added.
Response = acDataErrAdded
Exit_CustomerID_NotInList:
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
Private Sub Service_NotInList(NewData As String, Response As Integer)
Dim Db As Database
Dim Rs As Recordset
Dim Msg As String
On Error GoTo Err_CustomerID_NotInList
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Confirm that the user wants to add the new customer.
Set Db = CurrentDb
Set Rs = Db.OpenRecordset("Services", dbOpenTable)
' Create a new record.
Rs.AddNew
' Assign the NewID to the CustomerID field.
' Rs![Full name] = NewID
' Assign the NewData argument to the CompanyName field.
Rs![ServiceName] = NewData
' Assign the NewID to the CustomerID field.
'Rs![Country] = NewID1
' Save the record.
Rs.Update
' Set Response argument to indicate that new data is being added.
Response = acDataErrAdded
Exit_CustomerID_NotInList:
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