Type Mismatch

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am getting a Type Mismatch error (Runtime 13) when I try to execute the following code:

Dim db As Database
Dim recEmployee As Recordset
Dim strTableEE As String
Dim strDate As Date
strTableEE = "dbo_tblPREE"

Set db = CurrentDb
Set recEmployee = db.OpenRecordset(strTableEE, dbOpenSnapshot) <<<< THIS IS WHERE THE ERROR IS HAPPENING

I get the same error when I try "? dbengine.Workspaces (0).Databases (0)" in the Immediate Window
 
Greg,

Do you have a reference set to the DAO Object Library that is appropriate to
your version of Access?

To check this out, open any code module by pressing CTRL-G; then, select
Tools|References from the menu. If you are using Access 97, you need a
reference to the Microsoft DAO 3.51 Object Library; for Access 2000 and
newer, you need the Microsoft DAO 3.6 Object Library. Select the one that
is appropriate by clicking the checkbox to the left of the entry.

In addition, in databases where you may use ADO and DAO, it will help to
adopt the following coding practice of declaring which library is to be used
when declaring databases and recordsets. For example:

Dim rs as DAO.Recordset

hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Greg H said:
I am getting a Type Mismatch error (Runtime 13) when I try to execute the following code:

Dim db As Database
Dim recEmployee As Recordset
Dim strTableEE As String
Dim strDate As Date
strTableEE = "dbo_tblPREE"

Set db = CurrentDb
Set recEmployee = db.OpenRecordset(strTableEE, dbOpenSnapshot) <<<< THIS
IS WHERE THE ERROR IS HAPPENING
 
Back
Top