-
printing from a file
please help me with this one , i'm getting an error
run time error 62
inpu past end of file
here is the code
Dim filename As String
Private Sub cmdPrintForm_Click()
Dim name As String
Dim region As String
Dim amount As String
Form1.Show
Open filename For Input As #1
Do While Not EOF(1)
Input #1, name, region, amount
Print name; Tab(20); region; Tab(30); Format(amount * 1000, "£#,##0.00")
Loop
Close #1
End Sub
Private Sub Command1_Click()
Dim name As Integer
Dim region As String
Dim amount As Long
Printer.Print "Report on Annual Sales made by Sales Staff"
Printer.Print
Printer.Print
Printer.Print "Salesperson"; Tab(20); "Region"; Tab(30); "Value of Sales"
Printer.Print
Open filename For Input As #1
Do While Not EOF(1)
Input #1, name, region, amount
Printer.Print name; Tab(20); region; Tab(30); Format(amount * 1000, "£#,##")
Loop
Close #1
Printer.EndDoc
End Sub
Private Sub Command2_Click()
Form1.PrintForm
End Sub
Private Sub Form_Load()
filename = App.Path & "\sales.txt"
End Sub
-
Re: printing from a file
I changed your Name declaration from an Integer to a string and ran it with the following file. Worked fine for me.
Skippy,Australia,100
Lassie,USA,200
-
Re: printing from a file
ya i good it,
some problem in my sales.txt i didn't set a a comma (,) in one line