?
Solved

Appending data to a CSV file

Posted on 2000-05-09
5
Medium Priority
?
1,103 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 150 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

764 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