What on Earth?

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

Guest

Dim rstSrcC, rstSrcP, rstSrcD As Recordsets
Set dbs = CurrentDb()

Set rstSrcC = dbs.OpenRecordset("tblExportCalls_IMP") THIS WORKS
Set rstSrcP = dbs.OpenRecordset("tblExportProposals_IMP") THIS WORKS
Set rstSrcD = dbs.OpenRecordset("tblExportDeals_IMP") THIS FAILS WITH ERROR 13

I am well used to working with recordsets in code. I have checked all of the
usual suspects, the table exits etc. What on earth is causing this? I have
NEVER had this error with a recordset before. Is it possible corruption in a
system table? Where should I look for clues?
 
The Dim statement is wrong

You have declared 2 variants (since no type was specified) and an object of
type Recordsets.

I'm not aware of a Recordsets object, but both the ADO and DAO libraries
have a Recorset object, so the "wrong type" error message probably indicates
that the wrong type was assigned. You need to be specific to disambigute.

Try:
Dim rstSrcC As DAO.Recordset
Dim rstSrcP As DAO.Recordset
Dim rstSrcD As DAO.Recordset

More on references:
http://allenbrowne.com/ser-38.html
 
Implicity declared each recordset and it works, must have been lucky that
previous declarations worked without that.

Thanks
 
Back
Top