Moving Backward through text
Hi all, I have a prog that hashes a text file and is able to skip though large portions of it in the forward direction.
I need to be able to do the same thing in the reverse direction. This is the forward one -
VB Code:
Dim wc As String, I%, z%
' *****************************
Form1.MousePointer = 11
If last_rcd = 1 Then
CleanFields (1)
rcdcnt1% = totrcds%
'Form8.ProgressBar1.Value = 100
Form1.NEXTBUT.Visible = False
Form1.OptBut.Visible = False
CLOSEFILE_CLICK
End If
' *****************************
Do
If last_rcd = 0 Then 'filenum > 0 Then
ShowRecord '(last_rcd)
wc = Nsnap.SF1
I% = CkKeyWC(wc)
If ((I% = 0) And (Form4.Check1.Value = 1)) Or ((NoSupport$ = "yes") And (Form4.Check3.Value = 0)) Then
nextjcn% = JCNcnt1% + 1
SkipIt$ = "Y"
' **************
ElseIf nextjcn% > JCNcnt1% Then
SkipIt$ = "Y" ' Auto skip forward
ElseIf nextjcn% < JCNcnt1% Then
Close (Filenum)
CleanFields (1)
JCNcnt1% = 0
rcdcnt1% = 0
skipcnt2% = 0
'Form8.ProgressBar1.Value = 0
Form8.Label8.Caption = " "
'Form8.Label17.Caption = "0%"
Open Filename For Input As Filenum
ReadCard (0) ' Lable card
ReadCard (1) ' Read 1st card
jcn = Left(textdata, 13)
'form1.Refresh
OLDJCN = jcn
SkipIt$ = "Y" '
Else
SkipIt$ = "N" '
nextjcn% = JCNcnt1% + 1
End If
'z% = (rcdcnt1% / totrcds%) * 100
'Form8.ProgressBar1.Value = z%
End If
Loop Until SkipIt$ = "N" Or last_rcd = 1 'filenum = 0
' ************************
NoSupport$ = "no"
flagopt% = 0
Get_Show ' Move fields to display window
Form1.MousePointer = 0
I thought I could just modify it and this is what I get that kinda works -
VB Code:
Dim wc As String, I%, z%
' *****************************
Form1.MousePointer = 11
If last_rcd = 1 Then
CleanFields (1)
rcdcnt1% = totrcds%
Form1.NEXTBUT.Visible = False
Form1.OptBut.Visible = False
CLOSEFILE_CLICK
End If
' *****************************
Do
If last_rcd = 0 Then 'filenum > 0 Then
ShowRecordReverse '(last_rcd)
wc = Nsnap.SF1
I% = CkKeyWC(wc)
If ((I% = 0)) And (Form4.Check1.Value = 1) Or ((NoSupport$ = "yes") And (Form4.Check3.Value = 0)) Then '
rcdcnt1% = rcdcnt1% - 1
SkipIt$ = "Y"
If ((I% <> 0)) And (Form4.Check1.Value <> 1) Or ((NoSupport$ = "NO") And (Form4.Check3.Value = 0)) Then '
Close (Filenum)
CleanFields (1)
Open Filename For Input As Filenum
ReadCard (0) ' Lable card
ReadCard (1) ' Read 1st card
ShowRecordReverse
End If
End If
End If
Loop Until SkipIt$ = "N" Or last_rcd = 1 'filenum = 0
' ************************
NoSupport$ = "no"
flagopt% = 0
Get_Show ' Move fields to display window
Form1.MousePointer = 0
It will read the record number in reverse, but not the text associated with the record.
Any Ideas?
John
Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack