Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CopyRecordSet

Status
Not open for further replies.

GarHeard

Programmer
Joined
May 3, 2005
Messages
28
Location
US
I noticed the following on an MSDN website:

CopyFromRecordset Method

Copies the contents of an ADO or DAO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range. If the Recordset object contains fields with OLE objects in them, this method fails.

I have an Access application and after executing a stored procedure and creating a recordset, I tried to use the CopyRecordSet as follows:

With objWS
.Range("A2").CopyFromRecordset rstQueryFS
.Cells.EntireColumn.AutoFit
End With

I get a run time error as follows:

Run-time error '-2147319779(8002801d')
method 'CopyFromRecordset'
of object 'Range' failed

Do you possibly know why I get this error? I am using Excel 2002. I don't think have any OLE objects types or array data. I'm just running a stored procedure (querying
a couple of tables).

I am trying to find a way to speed up the processing
of sending a recordset to an Excel file which is the format in which the user wants the output.


 
Does this have anything to do with SQL Server? You only seem to have mentioned Access and Excel.

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top