PDA

Click to See Complete Forum and Search --> : Type Mismatch


casox
Feb 23rd, 2000, 09:59 PM
I am working with a newly converted to Access 2000 database. Now, no matter which table I try to open (OpenRecordSet) I get a run-time error '13' Type mismatch for no apparent reason. It worked before!

Thanks,

casox

JHausmann
Feb 24th, 2000, 09:03 AM
Didya change your references to use the right version of DAO? or MDAC?

JohnAtWork
Mar 7th, 2000, 01:31 AM
I know what this is caused by, but I don't know the solution, myself.

Here's the code that will raise the error:



Public Sub CheckVers()
Dim PatchVers As Recordset
Dim CurrentVers As Recordset
Dim db As Database

Set db = CurrentDb
Set PatchVers = db.OpenRecordset("tblVersionNumber")
Set CurrentVers = db.OpenRecordset("tblCurrentVersion")



Upon either of the Set commands w/OpenRecordset method the 2000 db will return a type mismatch.

I've checked DAO 3.60 referencing, and still get the error.

JohnAtWork
Mar 7th, 2000, 10:39 PM
I found out the problem . . .
I had ADO 2.1 checked also, and it was first on my references list.

husky
Aug 15th, 2001, 01:05 PM
Hello, I have the same problem as Casox. Where I'm trying to connect to a Access 2000 database with my OpenRecordset. I have the lastest server pack for VB and MDAC. I also have checked DAO 3.60 referencing and still got the error. JohnAtWork said: "I had ADO 2.1 checked also, and it was first on my references list." but I can't find it in the list.

If anyone can help me, I would be grateful.

Thanks,

Husky

husky
Aug 15th, 2001, 01:21 PM
I found the problem. You have to clear the reference to Microsoft ActiveX Data Objects.

Thanks,

Husky

JohannS
Aug 16th, 2001, 06:46 AM
I needed the ActiveX components, but after removing the reference, and putting it back again, it worked fine.

No more Type Mismatch.

Strange thing though. Using a data control to connect to the db worked fine, only now when I used code only, did the error come up.

What gives?

Anyhow, thanks for the solution.

honeybee
Aug 16th, 2001, 07:21 AM
To avoid confusion, if you are using both ADO and DAO, use prefixes ADODB and DAO before the object types, for e.g. ADODB.Recordset and DAO.Recordset. This will clarify the code and also avoid such errors.

.