Link to home
Start Free TrialLog in
Avatar of mathprof
mathprof

asked on

type Mismatch error 13

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)

ASKER CERTIFIED SOLUTION
Avatar of ameba
ameba
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dannic
dannic

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.
Avatar of mathprof

ASKER

Brilliant.
I changed the dim statement.
And thanks for your speedy response. I never would have figured this one out!
Mathprof
Thanks  :-)