
VB5: Deleting records from a (text) data base?
I am having a hard time following this concept, all though the portion that is giving you a problem is easily fixed. You have the classic never use a Goto problem, you have short circuited the loop check by using a goto, you have already reached the end of the file but didn't check for it before trying to read the next data element. I am real confused as to where the data control is used and why, these just look like text files to me.
Do
line Input #1, Linebuffer
If SSN <> Left(Linebuffer, 9 ) Then
Print #2, Linebuffer
end if
Loop Until EOF(1)
Can someone tell me where I am going wrong here
(I am using the data OCX that ships with VB5):
-------------------snip--------------------------------
Private Sub cmdDelete_Click()
'this may produce an error if you delete the last
'record or the only record in the recordset
Data1.Enabled = False
RecordSource
Dim SSN As String
Dim Linebuffer As String
Dim Match As String
txtFields(0).Text = SSN
Open "C:\DEPO\Depo.txt" For Input As #1
Open "C:\DEPO\Depo.tmp" For Output As #2
Do Until EOF(1)
line Input #1, Linebuffer
If SSN = Left(Linebuffer, 9 ) Then
Else
Print #2, Linebuffer
End If
Loop
Close #1
Close #2
Kill "C:\DEPO\Depo.txt"
Name "C:\DEPO\Depo.tmp" As "C:\DEPO\Depo.txt"
Data1.RecordSource = "Depo#txt"
End Sub
-------------------------snip-----------------------------------
Any and all help will be appreciated!!!!
Cliff
--
****************************************
NOTICE TO BULK EMAILER(S):
Pursuant to US Code, Title 47, Chapter
5, Subchapter II, 227, any & all
unsolicited commercial e-mail sent to
this address is subject to a download
and archival fee in the amount of
$500 US and copies will be forwarded
to domain administrators--E-mailing
denotes acceptance of said terms!
****************************************