Solved

Saving to a CSV file

Posted on 2001-06-11
3
163 Views
Last Modified: 2013-05-10
I want to be able to save the contents of a ADODB recordset to a csv file. Can someone point me in the right direction.

0
Comment
Question by:Frank
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
Comment Utility
The easiest method is this:
    Open "c:\testbed\Recordset.csv" For Output As #1
    Print #1, rs.GetString(adClipString, -1, ",", vbCrLf, vbNull)
    Close #1

This uses the GetString method of the ADODB.Recordset to format the data into CSV and simply writes it to a file in one go.

There are other methods which provide for more control over formatting but are more complex. If this is what you need then let me know and I can help you with that as well.
0
 

Author Comment

by:Frank
Comment Utility
Many thanks!
0
 
LVL 1

Expert Comment

by:ShaneCourtrille
Comment Utility
Actually that wouldn't follow CSV format would it?

CSV formatting requires an item be enclosed in ""'s if it contains any commas for instance.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now