am using vb6 and ms office 2007 on Windows 7 professional platform

i wrote code as below

dim db as database
dim rs as recordset
dim ws as workspace

Private Sub Form_Load()
Set db = OpenDatabase(app.path & "\Contacts.mdb")
Set rs = db.OpenRecordset("Info", dbOpenTable)
End Sub

Now, when i run my code then and error call "run time error 13 - type mismatch"

i created my database with ACCESS 2000 and i have already installed SP6 for VB6
earlier i used XP and i never find this kind of error. i dnt find same problem with my earlier codes. i find this error in NEW codes only....

plz help, where i am going wrong...

Edited 5 Years Ago by kbj123: n/a

I usually set db = CurrentDB, store the the db path in a string variable named path, (including the db extension at the end) and then when I set the recordset I can just do this, which will select all of the tables in your database:

Set rs = CurrentDb.OpenRecordset("SELECT Name " & _
                                    "FROM MSysObjects IN '" & path & "' " & _
                                    "WHERE Type=1 AND Flags=0")

Then when you want to select a particular object just do this:

Me.RecordSource = "SELECT * FROM [TableOrQuery] IN '" & path & "'"

When inserting/updating you will need a queryDef.

am using vb6 and ms office 2007 on Windows 7 professional platform

i wrote code as below

dim db as database
dim rs as recordset
dim ws as workspace

Private Sub Form_Load()
Set db = OpenDatabase(app.path & "\Contacts.mdb")
Set rs = db.OpenRecordset("Info", dbOpenTable)
End Sub

Now, when i run my code then and error call "run time error 13 - type mismatch"

i created my database with ACCESS 2000 and i have already installed SP6 for VB6
earlier i used XP and i never find this kind of error. i dnt find same problem with my earlier codes. i find this error in NEW codes only....

plz help, where i am going wrong...

How did you find installing SP6 on your computer? I've never managed to get it too work?

Office 2007 uses a different library. Someone had posted a similar problem a few months ago. I believe the Office 2007 Access uses a different database engine than the Jet engine (versions 2.x, 3.51, 4.0, etc.).

But use the following reference library from the Project/References menu: Microsoft Office 12.0 Access Database engine object Library. Access 2000 uses the Jet 4.0 engine, not the same engine as Access 2007.

VB6 was designed with the Jet Database engine as the database of engine of choice. However, it's nice to know that you can still use the newer up to date engines in this classic programming tool.

Edited 4 Years Ago by hkdani: n/a

This article has been dead for over six months. Start a new discussion instead.