Link to home
Start Free TrialLog in
Avatar of Mach1pro
Mach1pro

asked on

Insert EOF Marker

I have a database that is linking to text files.  The files will be changed frequently and the problem I have run into is that the files are created on a Unix machine that is not leaving a recognizable EOF marker.  I can manually open the file, put the curser to the right of the last character, hit the delete key, close the file and save changes. This corrects the problem.
Does anyone have an idea how I can automate this procedure from Access?
I'm posting the question at 75 points, but will double it if someone gives me a working solution by 9:00 AM ET Saturday.
ASKER CERTIFIED SOLUTION
Avatar of mberumen
mberumen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Problem is the fact that Unix files have only Linefeed and Dos files Linefeed/CarriageReturn.
There are converters for translating the file to and fro Unix format.

In your case you could open the file in access binairy format and check for the chr(10) (linefeed) if so, write chr(13) & chr(10) after this conversion the file is "access-readable"
Normally however I would recommend a FTP to a DOS-machine and specify the LF => CRLF conversion.

Nico
BTW do you have to link to these files or could you use a VBA function to extract the data and insert it into your tables?
I assume conversion could take a while and when you are already processing the from VBA you could as well add the INSERT to it, so you don't have to write it anyway.

If you want a conversion utility UNIX2DOS then I can mail you one, but there must be lots of them on the web too.

Nico
Avatar of Mach1pro
Mach1pro

ASKER

Adjusted points from 75 to 150
mberubin
The part of the code that tests for the missing EOF  works fine. The correction part throws the program into an endless loop because because the Line Input command sees the entire file as one line. I have used the test part of your code with a few modifications and then created a form and routine to instruct the user how to fix the problem and opened up notepad to the file. Thanks for your help.  I didn't have time to search your link for additional info.