Add a line to a text file

R

Raphael

Hello,
I need to add a line to a csv file through access (at the begining not the end of the file).
In Excel VBA I would have been using Print#
How can I do that in Access.
Many thanks.
R
 
C

Cheryl Fischer

You would use the Open Statement in combination with either the Print # or
Write # Statements in much the same way that would do it in Excel VBA. In
fact, the VBA Help files on these statements appear to be identical in Excel
and Access.

As to adding a line to the beginning of your csv file, AFAIK, the Windows
file system does not support "pre-pending" data into text files. The only
thing I could recommend is to create a new file, write your string, then
open the saved file and append each line from it into the new file you have
created. To do this, you would use the Open and Input # Statements, among
others. You can get more information on these statements in VBA Help.
 
T

Tim Ferguson

As to adding a line to the beginning of your csv file, AFAIK, the Windows
file system does not support "pre-pending" data into text files.

c:\data > copy header.txt + body.txt wholefile.txt


There's life in that old dos yet. It's amazing how many simple things
Windows tries to make hard.

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top