Hi.... I am a student.

When i tried to connect VB with Access, it is giving me this message "Run-time error 13, Type Mismatch" Below is the code

Dim DBase As Database
Dim RBase As Recordset

Set DBase = OpenDatabase("DB Name")
Set RBase = DBase.OpenRecordset("Table name")

The funniest thing is, this same code works on another project on the same computer.

Somebody help meeeeeeeeeeeee.

Edited 7 Years Ago by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

What is the version of the database you are having problems with? You may have to convert it to a previous version...

Another thought. Did you add the reference to the data access object?

Good Luck

What is the version of the database you are having problems with? You may have to convert it to a previous version...

Another thought. Did you add the reference to the data access object?

Good Luck

Yes I add everything

if you want to use upper version of office then you need service pack 6 of vb6.

How can we get this service pack 6?

Dim DBase As Database
Dim RBase As Recordset

Set DBase = OpenDatabase("DB Name")
Set RBase = DBase.OpenRecordset("Table name")

Try to use database name and table names without spaces. eg: DBName , TableName...

Which line shows the error ?

Make sure that the data saved to the database is of the same datatype of those in the Fields...

eg: "abcd"(string) to IntegerField is not applicable...

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