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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill the same spreadsheet with 2nd recordset

Status
Not open for further replies.

rwei

Programmer
Nov 19, 2004
55
US
I am using copyFromRecordset (something like this:
Code:
SS1.ActiveSheet.Cells.copyFromRecordset adoRs, 3000
to fill my spreadsheet with results from a SQL query. How do I continue to fill this same spreadsheet with results from another query?

Thanks.
 

Use the code below after your own, in order to define the last used row.

Code:
dim lastrow as long

SS1.ActiveSheet.Cells.copyFromRecordset adoRs, 3000

    LastRow = ActiveSheet.Cells.Find(What:="*", _
      SearchDirection:=xlPrevious, _
      SearchOrder:=xlByRows).Row


then use

XXX.activesheet.cells(lastrow,1).copyfromrecordset XXX, XXXX

to insert the new query data.


// Patrik
______________________________

To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the IT Professional, the glass is twice as big as it needs to be.
 
Thanks!

I am using VBScript on ASP page, there seems to be some differences in the codes used? I am still trying to use your example to make it work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top