Solved

type Mismatch error 13

Posted on 2002-04-17
4
323 Views
Last Modified: 2010-05-02
I need help. Why the type mismatch.
I copied the code from another of my programs and there is no error in the other program. tbl.name is a string.


Dim dbmath As Database
Dim rs As Recordset
Dim ws As Workspace

Set ws = DBEngine.Workspaces(0)
Set dbmath = ws.OpenDatabase(NuevaDB$ + ".mdb")
'next statement gives 'type mismatch' WHY?
Set rs = dbmath.OpenRecordset(tbl.Name, dbOpenDynaset)

0
Comment
Question by:mathprof
[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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 100 total points
ID: 6949254
Remove reference to MS ADO 2.x, or move it down to have less priority than DAO 3.x, or change declaration:
>Dim rs As Recordset
to
Dim rs As DAO.Recordset
0
 
LVL 3

Expert Comment

by:dannic
ID: 6949276
Hi mathprof,

What DAO Library do you use?
The code works with a reference to Microsoft DAO 3.6 Object Library.

Make sure that tbl.Name contain a valid tablename.
0
 

Author Comment

by:mathprof
ID: 6949335
Brilliant.
I changed the dim statement.
And thanks for your speedy response. I never would have figured this one out!
Mathprof
0
 
LVL 15

Expert Comment

by:ameba
ID: 6949338
Thanks  :-)
0

Featured Post

Industry Leaders: 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 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