Solved

Appending data to a CSV file

Posted on 2000-05-09
5
1,089 Views
Last Modified: 2008-03-06
How can append the data collected in a table to a CSV (commar seperated variable) file using VBA.  I know I can open the file itself into Access and add the data to it and save it however this would take sometime.  I was wondering if there was a less time consuming method.

Cheers.

Simon
0
Comment
Question by:SIMONWALLACE
[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
5 Comments
 
LVL 2

Expert Comment

by:WonHop
ID: 2793958
Hello Simon
Try using the TransgerText.

DoCmd.TransferText acExportDelim, "Table1", "Output1.Txt", True

WonHop

   
0
 
LVL 54

Accepted Solution

by:
nico5038 earned 50 total points
ID: 2793990
Using a write after opening the file in APPEND mode is the fastest.

The only other way is to create the whole file from the tables if it's still there.

Or just create a new file and append it in Wordpad or Word by inserting the new file at the end. But I think your not waiting for that manual solution.

Nico
0
 
LVL 2

Expert Comment

by:WonHop
ID: 2793992
This is one that I use now.

 strFullPathCSV = "C:\Data\NewCSV.txt"
    DoCmd.TransferText acExportDelim, , "qsel_CSV", strFullPathCSV, True

Hope this helps

WonHop
0
 
LVL 3

Expert Comment

by:davereynolds
ID: 2794579
To WonHop,
From Help: "Microsoft Access creates a new text file when you export data from Microsoft Access. If the file name is the same as the name of an existing text file, Microsoft Access replaces the existing text file."
If Simon wants to append to an existing file, another way will need to be used.
0
 
LVL 2

Expert Comment

by:WonHop
ID: 2794637
Thanks davereynolds.
Could he just create a table in the database that will hold the information he needs.  Run an Append Query to Add the new data to the existing table along with all of the previous information.
Then created the CSV file.

If he does not want to keep it in the current DB.  It can be exported and Appended and kept in a separate database.  Then from there create the CSV file.

All of that could be done with VBA.
Would something like that work?

WonHop
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

733 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