Solved

Appending data to a CSV file

Posted on 2000-05-09
5
1,093 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

729 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