# vb: append data to text file



## mmin8 (Apr 12, 2005)

I'm working with access 2000 and I've wrote a macro in visual basic to write data on a text file (visualbasic ver.6).

I'm writeing the data in appending mode, but I'd like to write the data every time in new line, unfortunately the data are placed all on the same line...
How can I append the data on a new line?

Hereafter the code I wrote: 
...
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim f, fs
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\temp\timerec.txt", ForAppending, -2)
f.write ("date: " & Date)
f.Close
...


Hope you can help me
Thanks
Marco


----------



## chloroformed (Jun 7, 2005)

try using f.WriteLine instead of f.Write


----------



## mmin8 (Apr 12, 2005)

*vbcrlf = visual basic carriage return line feed*

I found it:
& vbcrlf = visual basic carriage return line feed 
Regards
MM


----------



## rohit_vk (Mar 12, 2010)

Open "c:\demo" For Append As #1
Print #1, "Hello ..."
Close #1


//try this 3 lines of code & reply.


----------

