Solved

input past end of file

Posted on 2011-02-19
8
517 Views
Last Modified: 2012-05-11
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
Comment
Question by:anushahanna
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Assisted Solution

by:jo_m
jo_m earned 150 total points
ID: 34936010
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
 
LVL 6

Author Comment

by:anushahanna
ID: 34936020
what program can help to see if the csv file has carriage return?
0
 
LVL 2

Expert Comment

by:jo_m
ID: 34936044
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 44

Expert Comment

by:GRayL
ID: 34938499
What code are you using to read the CSV file?
0
 
LVL 6

Author Comment

by:anushahanna
ID: 34957461
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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 350 total points
ID: 34966474
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
 
LVL 6

Author Comment

by:anushahanna
ID: 34976417
thanks Jeff.. I asked at the source to make sure to trim the unneeded chars..
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34977432
;-)
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

777 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