• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

input past end of file

when the program reads a csv file and complains "input past end of file", does that mean there are characters past the EOF? (maybe an extra space etc)

what else could it be?
0
anushahanna
Asked:
anushahanna
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
jo_mCommented:
hello    there
No  it means you could have a spare carriage return in the  csv file! so you do one extra loop

 check to see if its there
tx

jo
0
 
anushahannaAuthor Commented:
what program can help to see if the csv file has carriage return?
0
 
jo_mCommented:
hello again

 if you copy the  text from notepad into word and  check the  backwards  P  on the which shows all the  Carriage returns  in a document


CR.bmp
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
GRayLCommented:
What code are you using to read the CSV file?
0
 
anushahannaAuthor Commented:
i am using access code.

the record inside the csv ends with crlf
could that be the problem?

is it possible trim the cr off?

thank you.
0
 
Jeffrey CoachmanMIS LiasonCommented:
This error is usually related to VB code used to "Read" a text file.
ex:
Open "C:\YourFolder\YourFile.csv" For Input As #1
...

Here is what the first hit in google had to say.
Perhaps it will help:
http://msdn.microsoft.com/en-us/library/1k5e45de%28v=vs.80%29.aspx
To correct this error
   1. Use the EOF function immediately before the Input statement to detect the end of the file.
   2. If the file is opened for binary access, use Seek and Loc.

<i am using access code.>
If the info in the link does not help, then can you post the code you are using?

What is the goal in reading the file?
Since you posted this in the Access zone, I will presume you want to import this file into Access as a table?
If so, then the standard Access code will not generate this error, and if this is a true CSV file, and there is in fact only one CRLF, then Access will ignore the one trailing CRLF and import the table just fine.

If however there is more than one CRLF (And you are indeed sure this is in fact a CRLF, and not some other non-printable character) Access will simply create blank rows for each additional CRLF beyond the first one.

    DoCmd.TransferText acImportDelim, "YourCSVImportSpec", "YourTableName", "C:\YourFolder\Test.csv", True

Obviously to use this code you must have done the import once, saving your settings as an Import Specification.

;-)

JeffCoachman
0
 
anushahannaAuthor Commented:
thanks Jeff.. I asked at the source to make sure to trim the unneeded chars..
0
 
Jeffrey CoachmanMIS LiasonCommented:
;-)
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now