[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?
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
:wave:
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