Solved

type Mismatch error 13

Posted on 2002-04-17
4
320 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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks  :-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now