Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using notinList

Status
Not open for further replies.

finberg

Programmer
Aug 23, 2002
27
UA
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
 
If you're using Access 2000, then you will need to set a reference to Microsoft DAO 3.6 Object Library. Your Dim statements would then look like this:

Dim Db as DAO.Database
Dim Rs as DAO.Recordset
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top