Solved

type Mismatch error 13

Posted on 2002-04-17
4
322 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
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

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

Suggested Solutions

Title # Comments Views Activity
SQL VB connection works in one PC and doesn't in another 15 73
Error when passing an argument to a vb6 that contains  '/' 7 45
Spell Check in VB6 13 135
Advice in Xamarin 21 109
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

740 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