RecordsetCloning with ADO...

  • Thread starter Thread starter Jason Barnable
  • Start date Start date
J

Jason Barnable

I have a problem,

My supervisor and I are switching an Access 2002 database from DAO to
ADO. We are running into a problem where recordset clones are used. It is
my understanding that there is no recordsetclone property for use with ADO.
I was wondering if anyone else has run into this problem and has found a
work around for it. After a couple of days of searching I'm still without
an answer. Any help would be greatly appreciated.
 
Here is the code that I have:

Dim recClone As ADODB.Recordset
Set recClone = Me.RecordsetClone() <<<'Type Mismatch' Error

I have also tried:

Set recClone = Me.Recordset.Clone <<<'Type Mismatch' Error

I'm not sure what I'm doing wrong.
 
Jason Barnable said:
Here is the code that I have:

Dim recClone As ADODB.Recordset
Set recClone = Me.RecordsetClone() <<<'Type Mismatch' Error

I have also tried:

Set recClone = Me.Recordset.Clone <<<'Type Mismatch' Error

I'm not sure what I'm doing wrong.

If "Me" is a bound form in an .mdb database, then (unless you bound it
to an ADO recordset by programming) its Recordset is a DAO recordset,
not an ADO recordset. Therefore the recordset's clone will also be a
DAO recordset, so your code attempting to assign that to an ADO
recordset object will get a type mismatch.

You can either Dim recClone As DAO.Recordset and use DAO methods, or Dim
recClone As Object and use late binding to call only those methods that
DAO and ADO recordsets have in common. Look at the code generated by
the wizards for examples.

Note that, if your form is in an Access Data Project (.adp file), then
the form's Recordset is an ADO recordset.
 
Back
Top