?
Solved

Input past end of file - error 62 when trying to review a text file...

Posted on 2006-04-19
7
Medium Priority
?
366 Views
Last Modified: 2012-06-21
I'm having difficulty in overcoming a #62 error with the following code:  Please let me know what I'm doing wrong:
I get the error highlighted on line:  Input #1, sName, bAdjust, bLogOut, sDate, sUserName
When I review the text file:  I got the following one line item....
C:\WORK\010-DBtieaccess\dbtieaccess.mdb   -1             0            4/19/2006 7:14:41 PM        SLecompt

Public Function Check_Maintenance(sDBName As String) As Boolean
On Error GoTo Err_DoSomething

  Dim bLogOut As Boolean
  Dim sName As String
  Dim bAdjust As Boolean
  Dim sUserName As String
  Dim sDate As String
  Dim bFound As Boolean
  Dim lFile As Long
  lFile = FreeFile
  '@@@ add code here
  'to pull file first over to C:\ if connected to network only
  'and of course comparing DateFileTime modified date
  'then run it off your C:\ without affecting the network...
  Open tieFileSource & "\dbnames.list" For Input As #lFile
  Do While EOF(lFile) = False
    If EOF(lFile) = True Then
      Exit Do
    Else
      Input #1, sName, bAdjust, bLogOut, sDate, sUserName
      If sName = sDBName Then
        bFound = True
        Exit Do
      End If
    End If
  Loop
  Close #1

  If bFound = False Then bLogOut = False
  Check_Maintenance = bLogOut
 
Exit_Something:
  Exit Function
Err_DoSomething:
  Call Need_ErrorAction(Err, Err.Description, "zDBAssign @ Check_Maintenance", Erl())
  Resume Exit_Something
End Function
0
Comment
Question by:stephenlecomptejr
  • 4
  • 3
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 16494208


            Line Input #1, sName, bAdjust, bLogOut, sDate, sUserName
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 16494286
When I try the following - Line Input #1, sName, bAdjust, bLogOut, sDate, sUserName

I get a compile error:  syntax error with the highlight on the comma , after sName.
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 16494290
Also when I first have this file saved or appeneded - it is with the following:

Dim lFile As Long
lFile = FreeFile
Open tieFileSource & "\dbnames.list" For Append As #lFile
Print #1, CurrentDb.Name, -1, 0, Now(), Need_myUserName
Close #1
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 16494338
oh sorry.

this codes will read the text file line by line

Dim lFile As Long, TextLine as string
lFile = FreeFile
Open tieFileSource & "\dbnames.list" For Input As #1
Line Input #1, TextLine  

<TextLine will contain the first line of your text file.>
Do While Not EOF(1)
'codes here
 
Loop
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 16494355
Oh okay -

having the VBA codingi this way:
Open tieFileSource & "\dbnames.list" For Input As #lFile
  Do While EOF(lFile) = False
    If EOF(lFile) = True Then
      Exit Do
    Else
     
      Input #lFile, sName, bAdjust, bLogOut, sDate, sUserName
      Debug.Print sName, bAdjust, bLogOut, sDate, sUserName
      If sName = sDBName Then
        bFound = True
        Exit Do
      End If
    End If
  Loop
  Close #lFile

it stops at :  Input #lFile, sName, bAdjust, bLogOut, sDate, sUserName and gives run-time error 62 input past end of file.

when I do a Print sName I get:
C:\WORK\010-DBtieaccess\dbtieaccess.mdb   -1             0            4/19/2006 7:14:41 PM        SLecompt

and all the other variables are blank...
so how I can make this grab each invidual line item and put in a variable?
I don't want it to be like:  

Open tieFileSource & "\dbnames.list" For Append As #lFile
Print #1, CurrentDb.Name
Print #1,  -1,
Print #1, 0
Print #1, Now()
Print #1, Need_myUserName
Close #1

I need it all on a single-line item.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 16494392
<TextLine will contain the first line of your text file.>
s/b

<TextLine will contain the  line by line of your text file.>
so the first

Line Input #1, TextLine   ' will contain the first line  

the second

Line Input #1, TextLine   ' will contain the second  line   etc.,..
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 16494432
This also a matter of changing the Print statement syntax to something else:
Had to include " , " in the statement for the variables!

Print #1, Need_MyCPUName & " , " & Need_myUserName & " , 0, " & Now()

Thanks for trying to help me- cap!
Always!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question