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

Create a Comma Separated Value CSV file

Status
Not open for further replies.

Leonard

Programmer
Jan 26, 1999
10
US
Does someone have some sample code, to be used in VB6 to create a CSV file from a recordset.

Thank you
 
Here's a very simple approach.

RS.MoveFirst
Open "c:\output.csv" For Output As #1
Print #1, RS.GetString(, , ",", vbCrLf)
Close #1

Once you have the recordset you can convert it to a string. If there's a lot of data, you could loop through each record and then have the GetString() method only return 1 row of data and write that out each time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top