PC Review


Reply
Thread Tools Rate Thread

How to add data into a text file without overwriting existing data

 
 
=?Utf-8?B?SkBZ?=
Guest
Posts: n/a
 
      27th Jun 2007
I'm using

Print FileNumber, LineofText

to copy one line of text from one text file to another text file. If I close
the file and reopen them to write again, the previous data gets erased. How
do I open the write file so what is already in it stays and what I add to it
follows ?
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      27th Jun 2007
What you didn't include in your message was your Open statement. If you open
the destination file for Output, existing contents are destroyed. If you
open it for Append, new content is added to the end of the file.

Open "C:\Test.txt" For Append Access Write As #FileNum


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"J@Y" <(E-Mail Removed)> wrote in message
news:F5DD9E79-D21F-4367-ADA6-(E-Mail Removed)...
> I'm using
>
> Print FileNumber, LineofText
>
> to copy one line of text from one text file to another text file. If I
> close
> the file and reopen them to write again, the previous data gets erased.
> How
> do I open the write file so what is already in it stays and what I add to
> it
> follows ?


 
Reply With Quote
 
=?Utf-8?B?SkBZ?=
Guest
Posts: n/a
 
      28th Jun 2007
Excellent. Thanks, the Append worked.

"Chip Pearson" wrote:

> What you didn't include in your message was your Open statement. If you open
> the destination file for Output, existing contents are destroyed. If you
> open it for Append, new content is added to the end of the file.
>
> Open "C:\Test.txt" For Append Access Write As #FileNum
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting
> www.cpearson.com
> (email on the web site)
>
> "J@Y" <(E-Mail Removed)> wrote in message
> news:F5DD9E79-D21F-4367-ADA6-(E-Mail Removed)...
> > I'm using
> >
> > Print FileNumber, LineofText
> >
> > to copy one line of text from one text file to another text file. If I
> > close
> > the file and reopen them to write again, the previous data gets erased.
> > How
> > do I open the write file so what is already in it stays and what I add to
> > it
> > follows ?

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preventing users from overwriting existing data =?Utf-8?B?R2luYSBL?= Microsoft Access Forms 8 30th Sep 2008 08:55 PM
Importing data from text file without overwriting certain cells Sean Murphy Microsoft Excel Discussion 1 30th Jun 2007 06:19 AM
Importing data from text file to already existing access file =?Utf-8?B?UG9vamE=?= Microsoft Access 1 14th Jun 2006 02:31 AM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Microsoft Excel Programming 6 2nd Dec 2004 08:34 AM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Microsoft Excel Programming 3 1st Dec 2004 08:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:42 PM.