Split Reader

Working on a security system that reads a text file. I have the inpute set up, but when it ges to read the file, the split command gives me the error either " Input past end of file" or "Subscript Unreachable". the format of thel ine I need to read is as follows:

UserName<>UserPass<>AccessLevel

 Here's the command code:

//////////////////////////////////////////////////////
Private Sub cmdOK_Click()
   sUsername = txtUserName.Text ' used later in program, required line
Open sPWL For Input As 1 ' sPWL == App.Path + \Data1.dat
Line Input #1, sTemp ' used to skip Input marker past first line, which contains authorization code.
Do Until EOF(1)
Do While InStr(1, sTemp, vbCrLf) = 0 ' Meant to end at each line
Input #1, sTemp
If txtName.Text = Split(sTemp, "<>")(0) And txtPass.Text = Split(sTemp, "<>")(1) Then
frmLogin.Visible = False
frmMain.Visisble = True
Loop
Loop
Close 1
End Sub
////////////////////////////////////////////////////////

Any help with why it gives me these error messages would be greatly appreciated. Probably something simple, I still pretty new to this.
AioreynAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DocMCommented:
With the inside loop

Do While InStr(1, sTemp, vbCrLf) = 0 ' Meant to end at each line
Input #1, sTemp
Loop

you reach the end of the file without testing the EOF.

Try this:
Open sPWL For Input As 1 ' sPWL == App.Path + \Data1.dat
Line Input #1, sTemp ' used to skip Input marker past first line, which contains authorization code.
While EOF(1) = False
Input #1, sTemp
If txtName = Split(sTemp, "<>")(0) And txtPass = Split(sTemp, "<>")(1) Then
frmLogin.Visible = False
frmMain.Visisble = True
End If
Wend
Close 1
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.