Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding data into a text file at different times.

Status
Not open for further replies.

FreedomP

ISP
Jun 28, 2003
14
CA
I want to run a program that will keep track of names entered into a file. I can get it to enter data into the file each time that the program runs but it just writes over the data from the previous entry. This is the code that I am using.

Open "C:\MyFiles\Visual Basic 6.0\Excel Storage\Username Storage.txt" For Output As #1
Print #1, frmReg2.User
Close #1
Debug.Print frmReg2.User

I was wondering if there is a way to program around this.
 
You might try opening the file for Append rather than for output.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thanks a lot, that did the trick. I completely forgot about append.
 
or if you are really brave try a binary open and handle each character (use byte type or byte array to get at them) which quite easy if you dump in regular size blocks (or box them up in fixed length chunks)

Dim array(0 to 127)

blah blah load you array

eg Put #1 , data position, array
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top