OpenTextFile & ReadLine help

martinpratt

Registered User.
Local time
Today, 23:39
Joined
Oct 17, 2012
Messages
22
HI All,

I am trying to read the first line of a file in access 2010, but it is not returning the correct text.

I am using code

Set readContent = fs.OpenTextFile(pathLong, 1, 0)
lineRead = Mid(readContent.ReadLine, 77, 40)

the result of lineRead in access is - ?A ???? ?????  @ ???A ???????

but if it drag the file into notepad I get (on one line) - Ver461 M1  4.61 4.61 MARTIN 937-1424B - JUNCTION - 1/03  4ðÕ4åã@4ðÕ4åã@Í?

I have tried Set readContent = fs.OpenTextFile(pathLong, 1, 1) and 2 but no luck.

All ideas gratfully received

Martin
 

Thanks for the links, I will take a look.

further info, I forgot a bit of the code..

Set fs = CreateObject("Scripting.FileSystemObject")
Set readContent = fs.OpenTextFile(pathLong, 1, 0)
lineRead = Mid(readContent.ReadLine, 77, 40)

Where pathLong is the path and file name and lineRead is the output

I should also say tha the input file for opening is not just a text file, it is a file created by another system, who's format is unknown

Thanks

Martin
 

Users who are viewing this thread

Back
Top Bottom