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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
0
0
US
I keep on getting a type mismatch with the line of code below

Set rs = db.OpenRecordset("temp", dbOpenDynaset)

Below is the code


Private Sub Text43_Change()

Dim db As Database
'Dim qdf As QueryDef
'Dim strSQL As String
Dim rs As Recordset
Dim i As Integer

Set db = CurrentDb
Set rs = db.OpenRecordset("temp", dbOpenDynaset)

'DoCmd.RunSQL "Delete * from tblAddressMatch"
If Not (IsNull(Text43)) Then
For i = 1 To Text43
rs.AddNew
rs!Text43 = Text43
rs.Update
Next i
End If

Text43 = Null

End Sub
 
You need to declare the recordset as either ADO.Recordset or DAO.Recordset and ensure there is an appropriate reference to the ADO or DAO code library.

Craig
 
It should be either:
Dim db as DAO.Database, rst as DAO.RecordSet or
Dim rst as ADODB.RecordSet James Goodman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top