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

OpenRecordSet: Error Type Mismatch

Status
Not open for further replies.

suoirotciv

Programmer
Dec 3, 2002
205
PH
I have this code below in VB. And i got this Run-time error '13': Type mismatch

Did I miss something???

Thanks for any help to resolve this problem

===================================================
'REFERENCE: DAO 3.51

If Len(Dir$("c:\Database.mdb")) > 0 Then Kill ("c:\Database.mdb")
If Len(Dir$("c:\Database.mdb")) = 0 Then
Set tmpDB = CreateDatabase("C:\Database.mdb", dbLangGeneral)
tmpDB.Execute "CREATE TABLE Table1 (Field1 NUMBER, Field2 DATE)"
End If

Set tmpRS = tmpDB.OpenRecordset("Table1")
With tmpRS
.AddNew
!Field1 = Value1
!Field2 = Value2
.Update
End With
Please pardon the grammar.
Not good in english.
 
Hey i already got the answer from a friend

i just need to add the DAO to my declaration

my previous declaration was
Dim tmpRS as Recordset

This one is right
Dim tmpRS as DAO.Recordset Please pardon the grammar.
Not good in english.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top