Hi
I have this coding
Set recc = dbase.OpenRecordset(True, "Gate")


nfilenum = FreeFile
Open "C:\Rentention Program\20080517.daf" For Input As nfilenum


With recc
.MoveFirst

Do Until .EOF

Do While Not EOF(nfilenum)

If EOF(nfilenum) = True Then
GoTo ws:
Open "C:\Rentention Program\20080517.daf" For Input As nfilenum
Else
End If


Line Input #nfilenum, sNextLine
merid = Split(sNextLine, ",")(0)
merid = Replace(merid, """", "")
branch = Split(sNextLine, ",")(1)
branch = Replace(branch, """", "")
trancode = Split(sNextLine, ",")(4)
trancode = Replace(trancode, """", "")
cardno = Split(sNextLine, ",")(10)
cardno = Replace(cardno, """", "")
currcode = Split(sNextLine, ",")(18)
currcode = Replace(currcode, """", "")
tranamt = Split(sNextLine, ",")(19)
tranamt = Replace(tranamt, """", "")
trandef = Split(sNextLine, ",")(22)
trandef = Replace(trandef, """", "")
trancomm = Split(sNextLine, ",")(25)
trannet = Split(sNextLine, ",")(26)


If Mid(cardno, 9, 6) = "426351" Or Mid(cardno, 9, 6) = "433468" Or Mid(cardno, 9, 6) = "479714" Or Mid(cardno, 9, 6) = "432411" Then
GoTo wc:
End If

n = !Meid
m = merid + branch
If StrComp(n, m, vbTextCompare) = 1 Or StrComp(n, m, vbTextCompare) = -1 Then
GoTo wc:
Else
connec.BeginTrans
recc("Amt") = !Amt + trannet
.Update
connec.CommitTrans
GoTo wc:
End If


wc: Loop


ws: .MoveNext
Loop

MsgBox "Record Successfully updated"
End With
End Sub

And i am trying to do is for each record in recc do full loop on nfilenum.But the problem i am facing is that when the loop in nfilenum reach EOF i dont know how make it restart back to the begining of the file.

Can any one please help me.
Or email me collincon@seychelles.net

Correct syntax is:

do
...
loop until ........

OR

while .......
....
wend

Hi,
To reach the beginning of the file u can use
seek statement

Seek #filenumber, position
position = 1 represents the beginning of the file

Ex

Open .... For Input as #1
..
....

Seek #1, 1
....
Close #1

Hard syntax you have given, so many labels, It is very hard to understand the program flow. Please avoid Gotos

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.