In Access, I need to replace the first line of a text file. It seems the only way I can do this is to add the line I want to be the replacement (the new line) to a NEW file, copy all of the lines in the original file to the new file, and re-name the new file as the original file. This leaves me with two things I can't resolve: how do you delete the temporary file and how do I delete the SECOND line in the "now original" file (which is the line I wanted to replace initially but it got copied when I copied the text from the original file into the new file).
Here's the code I'm currently working with:
Print #1, strInput
Open strFileName For Input As #2
Do While Not EOF(2) ' Loop until end of file.
Line Input #2, TextLine ' Read line into variable.
Print #1, TextLine
Loop
Close #1
Close #2
SourceFile = strNewFileName
DestinationFile = strFileName
FileCopy SourceFile, DestinationFile
Thanks in advance!!
Kelly
Here's the code I'm currently working with:
Print #1, strInput
Open strFileName For Input As #2
Do While Not EOF(2) ' Loop until end of file.
Line Input #2, TextLine ' Read line into variable.
Print #1, TextLine
Loop
Close #1
Close #2
SourceFile = strNewFileName
DestinationFile = strFileName
FileCopy SourceFile, DestinationFile
Thanks in advance!!
Kelly