I need to ouput a file with a control block (header). In the form_load, I am setting my control block. My problem is that line eight must be the total of all records added from the sub AuditMe. I tried line input and either it doesn't work or I did it wrong. All the sub procedures involved are listed below. Any suggestions on how to do this?


Thanks


Private Sub Form_Load()
Call dbconnect
Call objectcmd
On Error Resume Next
Kill "c:\testing\mispunch.txt"
On Error Resume Next
Kill "c:\testing\kronos.dat"
myrecCnt = 0
myrs.MoveFirst
Open "c:\testing\mispunch.txt" For Append As #1
Open "c:\testing\Kronos.dat" For Append As #2
Print #2, "00"
Print #2, "0000000000"
Print #2, "0000000000"
Print #2, "0000000000"
Print #2, "0000000000"
Print #2, "0000000000"
Print #2, myrecCnt
Print #2, "0000000001"
Print #2, Spc(168); "32"
Call loopy
End Sub

Public Sub output()
Dim myfor As String
myfor = Format(newAdj, "00##")
myrecCnt = Format(myrecCnt, "0##########")
Print #2, "02"
Print #2, Spc(10)
Print #2, empnum
Print #2, mydate
Print #2, "0100"
Print #2, "999"
Print #2, Spc(12)
Print #2, "REG"; Spc(6)
Print #2, myfor
Print #2, adsb
Print #2, "00"
Print #2, "00"
Print #2,

End Sub

Public Sub AuditMe()
audAmt = 0
newAdj = 0

Do While Not myrsaud.EOF
If mydate = myrsaud("date") And empnum = myrsaud("empnum") Then
audAmt = (myrsaud("amnt") + audAmt)
End If
myrsaud.MoveNext
Loop
If audAmt <> breaktime Then
newAdj = breaktime - audAmt
myrecCnt = myrecCnt + 1
If newAdj < 0 Then
adsb = "01"
Else
adsb = "00"
End If
If newAdj < 0 Then
newAdj = newAdj * -1
End If
Call output
End If

myrsaud.MoveFirst
End Sub