Type Mismatch - OpenRecordset

HD20

Registered User.
Local time
Today, 00:02
Joined
Jun 25, 2002
Messages
27
I am getting a type-mismatch error in the coding below at the line Set rst = db.OpenRecordset("tblProspect"):

Private Sub CmbProspect_NotInList(NewData As String, Response As Integer)
Dim strMsg As String
Dim rst As Recordset
Dim db As Database

strMsg = "'" & NewData & "' is not in the list. "
strMsg = strMsg & "Would you like to add it?"
If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion, _
"New Company") Then
Response = acDataErrContinue
Else
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblProspect")
rst.AddNew
rst!ProspectName = NewData
rst.Update
Response = acDataErrAdded
rst.Close
End If
End Sub

Any thoughts would be greatly appreciated.

Thanks.
 
If you are using Access 97 or above,
and you include the ADO 2.1 library,
and you include the DAO 3.6 library,
then you must specify DAO.Database, DAO.Recordset, etc

RichM
 
Perfect, thanks
 

Users who are viewing this thread

Back
Top Bottom