Results 1 to 3 of 3

Thread: printing from a file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    28

    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

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    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
    Last edited by trisuglow; Feb 2nd, 2005 at 05:32 AM. Reason: I can't spell.
    This world is not my home. I'm just passing through.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    28

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width