while printing txt file my code always leave last few records however large database table I use
Code:
Function prntxt()
CNT = 1
sPath = "F:\" ' just have the directory here
Set rs = CurrentDb.OpenRecordset("SELECT * FROM ABC ORDER BY EMP_NO")
Open sPath & "SC.TXT" For Output As #1
Print #1, "S NO EMPL NO NAME"
Print #1, String(133, "*")
Do Until rs.EOF
Print #1, CNT; Tab(7); rs("EMP_NO"); Tab(15); rs("NAME")
''Print #1, CNT
CNT = CNT + 1
If (CNT Mod 30 = 1) Then
Print #1, Chr(12)
End If
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
MsgBox "FILE PRINTED SUCCESSFULLY"
End Function
Comment