Modify text file

arage

Registered User.
Local time
Today, 06:46
Joined
Dec 30, 2000
Messages
537
Modify text file
I have never really used dao or recordsets in any of my coding experience but think I am about too. I’ve got my form to the point where I can determine whether a file exists in particular directory and I need to modify this file by opening it (thru code) going to the bottom of the file (last record) & deleting it b/c it is an ENTER character, how might I go about this please?
 
So you want to delete an entire record? In that case I would just use a delete query. Easier to setup.
 
But how do i specify the eof record in the delete query???...i tried placing chr(13) as criteria for all fields but that changes nothing...to help you visualize what i do when i manually make this change....imagine the txt file open...i do ctl+end & then backspace key one time...this is what i need to get rid of....do you consider this chr(13), a carriage return, or what???

thanks for your patience....!
 
Maybe you should use vba.

Dim rst as DAO.Recordset

Set rst=CurrentDB.OpenRecordset("Table Name", DBOpenDynaset)

rst.MoveLast

rst.Delete


This should work.
 
Arage,


Dim buf1 As String
Dim buf2 As String

Open "C:\Infile1.txt" for Input As #1
Open "C:\Outfile1.txt" for Output As #2

Line Input #1, buf1
While Not EOF(1)
Line Input #2, buf2
If Not EOF(1) Then
Print #2, buf1
buf1 = buf2
End If
Wend

Close #1
Close #2

hth,
Wayne
 

Users who are viewing this thread

Back
Top Bottom