Opening recordsets in forms

  • Thread starter Thread starter Marta
  • Start date Start date
M

Marta

I am coding in the open event of a form.
When I try to open a recordset from table in my database:

Dim wrkJet As Workspace
Dim midb As Database
Dim cfbh As Recordset
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set midb = wrkJet.OpenDatabase("c:\qrx\refills62000.mdb")
Set cfbh = midb.OpenRecordset("cfbh", dbopentable)

It returns: Run-time error '13'
type mismatch

Why a type error?
 
Chances are that you're using ACCESS 2000 or 2002. These versions do not
have a reference to DAO library set as a default library. You need to go
into Tools | References (from VBE) and select Microsoft Data Access Objects
3.x library from the list.

Then disambiguate the Dims so that ACCESS doesn't think you want
ADODB.Recordset instead of DAO.Recordset:

Dim midb As DAO.Database
Dim cfbh As DAO.Recordset
 
Back
Top