[RESOLVED] Line Input

Hi, I want to have a loop and, within that loop, read one line of text at a time. What am I doing wrong?

Dim counter As Integer
counter = 1
For eee = 1 To weekinf
(do something)
(open txt file #2 for input)
Line Input #2, linetext(counter)
dateinf = linetext(counter)
(close txt file) Print #1, dateinf
(do something)
counter = counter + 1
Next eeeI get a "run time error 13 type mismatch" on the Line Input line of code.

Thanks.
[494 byte] By [Trizeen] at [2007-11-20 11:05:04]
# 1 Re: [RESOLVED] Line Input
What type of variable is linetext()?

However, according to the code you posted, the loop opens and closes the file with each iteration. That is, it opens the file, pulls the first line, then closes the file. Once the file is closed and reopened, the file pointer (which is used to determine where to begin reading in data) is set to the first line. So it will read the first line every time. It is not clear that this is the intended function.
WizBang at 2007-11-9 19:33:54 >
# 2 Re: [RESOLVED] Line Input
What type of variable is linetext()?I didn't declare linetext using the Dim statement. So, I guess it could be any type of variable. In addition, the text file contains dates. Like this...

Sep 01 2007
Sep 02 2007
Sep 04 2007

However, according to the code you posted, the loop opens and closes the file with each iteration. That is, it opens the file, pulls the first line, then closes the file. Once the file is closed and reopened, the file pointer (which is used to determine where to begin reading in data) is set to the first line. So it will read the first line every time. It is not clear that this is the intended function.Sorry about the ambiguity. I would like to change the file pointer so that on the first iteration of the loop the first date (Sep 01 2007) is input, then on the second iteration the file pointer goes to the second line of text and inputs that date (Sep 02 2007). I hope that makes sense, thanks for the reply.
Trizeen at 2007-11-9 19:34:57 >
# 3 Re: [RESOLVED] Line Input
Okay, I finally got it. Open the file, do what's required (no need for the counter), close the file.
Trizeen at 2007-11-9 19:36:02 >