LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default CopyFromRecordset with Filtered ADO recordset

My Excel application contains the following code to enter data from an ADO
recordset, rsStats, onto an Excel spreadsheet:

rsStats.Filter = "[DIST_CODE]='" & strTerr & "'"
RecCount = rsStats.RecordCount
..Cells(n, startCol).CopyFromRecordset rsStats

This code is contained within a loop that assigns different values to
strTerr and n. The result is that it returns the various filtered recordsets
at different locations on the spreadsheet.

This works fine in VBA, but now I have to transfer this functionality into a
vbscript that uses Office Automation to instantiate the Excel application,
open the Excel file and insert the data. When the code is run from vbscript,
rsStats.RecordCount returns the correct number of records for each filtering
of the recordset, but CopyFromRecordset always prints the complete,
unfiltered recordset.

Is there some way I can get CopyFromRecordset to recognize the filter when
working through Office Automation?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL CopyFromRecordset Bret Excel Programming 2 July 23rd 06 06:56 AM
CopyFromRecordset will fail if the recordset array data such as hierarchical recordsets ??? Mike[_108_] Excel Programming 0 June 10th 06 03:05 PM
CopyFromRecordset does nothing Hafeez Excel Programming 2 August 13th 04 07:20 PM
Type recordset/recordset? FlaviusFlav[_9_] Excel Programming 4 May 24th 04 12:16 PM
Copyfromrecordset Bug ? news.btx.dtag.de Excel Programming 1 August 1st 03 07:44 PM


All times are GMT +1. The time now is 04:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"