Saving Recordsets

  • Thread starter Thread starter William Barnes
  • Start date Start date
W

William Barnes

Using Excel 2000 under Win 2K Pro with ADO 2.5

Does Excel provide any easy way to copy the results of a database query (in
the form of an ADODB.Recordset object) onto a Worksheet? Any thing as easy
as assigning an array to a Range? Or do I have to loop through all the
Fields for each record and copy them "manually"?
 
Hi William,

Range("A1").CopyFromRecordset rsData
which uses part of the Excel Object Model (Range), and the CopyRecordset
method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
One other thing, now that I think of it. What about the reverse? Is there an
easy way to generate a Recordset from a Range object?
 
Don't think so William, you need to handle that.

By the way, on the original question, there is also the GetRows method that
load an RS into an array

arrayData = oRS.GetRows

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks again. I guess I'm not surprised since the CopyFromRecordset method
doesn't copy the field names.
 
Back
Top