With reference to Microsoft DAO 3.6 Object Library and the following code
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
Set dbs = dbs.OpenRecordset("DHTS")
the code fails in the last statement with "Type mismatch" and Run-time error
13.
DHTS is a table in my database. I have identical code - but with different
table name - running other places - and I have had this happen other places
as well. What's the reason...?

Signature
Diane
Ofer - 10 Jan 2006 22:04 GMT
You set the database as Recordset
Set dbs = dbs.OpenRecordset("DHTS")
change it to
Set rst = dbs.OpenRecordset("DHTS")

Signature
\\// Live Long and Prosper \\//
> With reference to Microsoft DAO 3.6 Object Library and the following code
>
[quoted text clipped - 9 lines]
> table name - running other places - and I have had this happen other places
> as well. What's the reason...?
DianePDavies - 10 Jan 2006 22:28 GMT
so embarassing.... this solved this issue. I was just blinded by the fact
that sometimes I really do get this error.

Signature
Diane
> You set the database as Recordset
> Set dbs = dbs.OpenRecordset("DHTS")
[quoted text clipped - 15 lines]
> > table name - running other places - and I have had this happen other places
> > as well. What's the reason...?
Ken Snell (MVP) - 10 Jan 2006 22:05 GMT
I assume you're running ACCESS 2000 or 2002 or 2003. In those versions, the
ADO library has higher priority than DAO (unless you've changed it
manually), and thus the Dim rst As Recordset step goes to the ADO library
and not the DAO library.
Disambiguate the dim statement:
Dim rst As DAO.Recordset

Signature
Ken Snell
<MS ACCESS MVP>
> With reference to Microsoft DAO 3.6 Object Library and the following code
>
[quoted text clipped - 11 lines]
> places
> as well. What's the reason...?