Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OpenRecordset type mismatch error 13

Posted on 2002-06-10
3
Medium Priority
?
1,089 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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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 …
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

972 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