Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


About the recordset

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,25679
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> About the recordset
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 About the recordset - 9/7/2005 8:49:20 PM   
  wmec

 

Posts: 125
Score: 0
Joined: 8/5/2004
From: Hong Kong, China
Status: offline
Hi,
I just want to put the field values in the recordset to the cells. Suppose that the recordset is from a query that returns a few fields inside, how can we distinguish these different ones; can we use oField.Value, oField.Value2 or something like this?

           For Each oField In rsadSet.Fields
                 oSheet.Cells(rw, 2).Value = oField.Value
           Next
           rsadSet.MoveNext

_____________________________

Thanks & Best Regards,

HuaMin Chen
 
 
Post #: 1
 
 RE: About the recordset - 9/7/2005 8:57:04 PM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Because the rsadSet.Fields keeps being re-read, the oField.Value keeps changing...so it should be only oField.Value IMO

Don't you need to put the rsadSet.MoveNext in the For Loop aswell?

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to wmec)
 
 
Post #: 2
 
 RE: About the recordset - 9/7/2005 9:08:25 PM   
  wmec

 

Posts: 125
Score: 0
Joined: 8/5/2004
From: Hong Kong, China
Status: offline
But 'MoveNext' is to go to the next record and how about that I want to read the 2nd field or 3rd one supposing that there're a few field for each row.



_____________________________

Thanks & Best Regards,

HuaMin Chen

(in reply to Snipah)
 
 
Post #: 3
 
 RE: About the recordset - 9/8/2005 2:08:47 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
You don't want to store each of the 2nd field or 3rd in oSheet.Cells(rw, 2).Value, do you?

So you would have to make seperate For loops then...IMO (as how i see it now)

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to wmec)
 
 
Post #: 4
 
 RE: About the recordset - 9/8/2005 2:10:48 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: online
The Excel.Range object has a CopyFromRecordset method that may address your problem.

(in reply to Snipah)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> About the recordset Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts