Solved

OpenRecordset type mismatch error 13

Posted on 2002-06-10
3
1,079 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

734 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