Recordset Object

  • Thread starter Thread starter Dominic
  • Start date Start date
D

Dominic

Hello,

I'm using Access 2002, and trying to create a recordset
object. I've Included the "Microsoft DAO" library in my
references.

I currently have a form, table and a module setup in my
database. I have used the Onload function of the form to
call a function named Setup() which has been coded in a
module. I keep on receiving the following error "Run-Time
Error 13 - Type Mismatch", when trying to Set the
recordset. This is what my module looks like:

Option Compare Database
Public db As Database
Private rst As Recordset
Option Explicit

Function Setup()

Set db = DBEngine.Workspaces(0).Databases(0)
-> Set rst = db.OpenRecordset("tblEmployee")

End Function

Any help would be appreaciated, thanks.
Dominic
 
Change:
Public db As Database
Private rst As Recordset
Set db = DBEngine.Workspaces(0).Databases(0)

To:
Public db As DAO.Database
Public rst As DAO.Recordset
Set db = CurrentDB()

See if this resolves the error.

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Starting with Access 2000, Microsoft added ADO (ActiveX
data objects). What Rob did was specify that Access is to
use the DAO (Data Access Object) library.

Roxie Aho
 
Back
Top