Results 1 to 3 of 3

Thread: [RESOLVED] Open Statement using a variable

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2007
    Posts
    31

    Resolved [RESOLVED] Open Statement using a variable

    I have 2 forms in this project.
    I am opening a txt file using a common dialog function to select the file
    and than storing that filename in a declared global variable as a string.

    My problem comes when I open the second form
    I need to be able to open the same file again to read the fields within.
    The Open statement seems to only accept a filename and won't let me use the variable.

    How can I open the file?

  2. #2
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Open Statement using a variable

    can you post the code ?

    This works just fine
    Code:
    Dim myvar As String
        Dim mytext As String
        myvar = "c:\test2.txt"
        Open myvar For Input As #1
        While Not EOF(1)
            Line Input #1, mytext
            MsgBox mytext
        Wend
        Close #1
    IIF(Post.Rate > 0 , , )

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2007
    Posts
    31

    Re: Open Statement using a variable

    Oops.
    Yet, another easy solution.
    I moved the variable to a global as I stated
    and then redid my Open Statement on the second form and it worked.
    I was placing the Open Statement under General Declarations instead of Form Activate.

    Thanks ZeeZee

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