Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

OpenRecordset - Run-time error '13'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DianePDavies - 10 Jan 2006 22:00 GMT
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...?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.