If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Problem in CopyFromRecordset

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-28-04, 02:24
ramram49 ramram49 is offline
Registered User
 
Join Date: Aug 2002
Posts: 16
Problem in CopyFromRecordset

Hi all,

I want to copy data from a recordset (an xml file) to an Excel spreadsheet. The following is the code fragment from a VBScript file:

Set rst = CreateObject("ADODB.Recordset")
rst.CursorLocation = 3 ' adUseClient
rst.CursorType = 3 ' adOpenStatic
rst.LockType = 1 ' adLockReadOnly
rst.Open "http://localhost/test/Final.xml", , , , 256
rst.Filter = "SRSROM = 'J18'"
Sheets(1).Cells(1, 1).CopyFromRecordset rst
rst.Close

My problem is that, the filter property seems not working well -- the whole recordset is imported into the spreadsheet, instead of the filtered records.

However, when I run the above code in Excel (ver 2003) VBA environment, it works (filters) perfectly.

Can anyone give me a hint on it.

Thanks in advance

Ram
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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