Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Saving to a CSV file

Posted on 2001-06-11
3
Medium Priority
?
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 6176505
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
ID: 6176520
Many thanks!
0
 
LVL 1

Expert Comment

by:ShaneCourtrille
ID: 6177961
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

604 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