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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can we delete 1 row from txt file? 2

Status
Not open for further replies.

Katya85S

Programmer
Joined
Jul 19, 2004
Messages
190
In access project the application should delete one row (starting with 'DL~') from txt file? Is it possible at all?
 
The usual way is to create a new file and write all the rows but the unwanted one.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
look into the replace function as well.
 
How can I search a data of a txt file from access application? I tried to find some references online, but found nothing.
 
Unfortunately FileSystemObject Object works in ASP pages, not in Access :(
 
Unfortunately FileSystemObject Object works in ASP pages, not in Access
Really ?
Code:
Sub myTestSub()
   Dim fso, f1, f2, s As String
   Const ForReading = 1, ForWriting = 2
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f1 = fso.OpenTextFile("c:\inputfile.txt", ForReading)
   Set f2 = fso.CreateTextFile("c:\outputfile.txt", True)
   While Not f1.AtEndOfStream
     s = f1.ReadLine
     If Left(s, 3) <> "DL~" Then f2.WriteLine s
   WEnd
   f1.Close: f2.Close
   Set f1 = Nothing: Set f2 = Nothing: Set fso = Nothing
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes! this absolutely does!
Thank you very much PH!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top