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

Deleting records from a text file on a server 1

Status
Not open for further replies.

jaggar

Programmer
Jan 23, 2003
21
US
My question, how can I delete records in a text file on the server using ACCESS/Visual Basic ?
Code used - when the User clicks on a button in Access the code behind:
Dim strAcctFileName As String
Dim fs, f, ts, S, a
Const ForReading = 1, ForWriting = 2
Const TristateUseDefault = 1, TristateTrue = -1, TristateFalse = 0
strAcctFileName = "Customer.txt"

Set fs = CreateObject("Scripting.FileSystemObject")

Set f = fs.GetFile("R:\path\" & strAcctFileName)

Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
ts.Close

Takes too long, is there another was?
Thanks Jaggar

 
Hi
Is there a reason why you cannot link to the file?
 
I do not want to form a likage with this text file to an Access table, because once I delete the records in the text file, other records will be written to it.

Thanks, Jaggar
 
I do not see why adding records should be a problem, but that is your decision.
Here are some threads:
Importing text file with headers and page breaks
thread700-719078

Random access:
replace a line in the array and overwrite the file
thread707-1103477

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top