Solved

OpenRecordset type mismatch error 13

Posted on 2002-06-10
3
1,078 Views
Last Modified: 2008-03-17
Here is my code:

Dim db3 As Database
Dim rsttemp As RecordSet
Set db3 = CurrentDb()
Set rsttemp = db3.OpenRecordset("tblTempArchPart")

On the set rsttemp line I get the following error:
Run time error '13'
type mismatch

I have tried including a second parameter such as dbOpenDynaset or dbOpenTable - neither makes a differenc.

The table is not a linked table - it has one record in it.
I have the Microsoft DAO 3.6 object library as one of the references.

Any ideas????
0
Comment
Question by:llap
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7067060
Try this:
Dim db3 As DAO.Database
Dim rsttemp As DAO.RecordSet

The problems is that you might have other references that have a Recordset type, which could be in the list before the DAO.records.

CHeers
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 7067117
If this is happening with Access 2000, the problem arises because the DEFAULT data access technology for Access 2000 is ADO, but the default type when you Dim ...as Database is DAO  Thus, you get a DAO recordset from the OpenRecordset method of the Database object, but the Dim ... as Recordset has declared the Recordset object as an ADO-type recordset, hence the Type mismatch.  as Angelll suggested, you can resolve the issue by EXPLICITLY declaring the Database and Recordset objects as DAO.
0
 
LVL 1

Author Comment

by:llap
ID: 7067262
"DAO." was the problem --- thanks! Appreciate Arthur's more definitive explanation -- but will accept angel's answer because it worked and it was posted 1st. Thanks again!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question