[AccessD] A2003:Read the last line of a text file

Heenan, Lambert Lambert.Heenan at AIG.com
Mon Dec 1 16:34:41 CST 2008


Try something like...

Dim strLine as string 
Dim nHandle as Long
nHandle  = FreeFile
Open SomeFile.txt for Input as nHandle
While Not EOF(nHandle)
	Line Input #nHandle, strLine
Wend
' results (last line of the file) are now in strLine
Close #nHandle

HTH

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren D
Sent: Monday, December 01, 2008 5:25 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] A2003:Read the last line of a text file

Hi Team

 

We have an external tool that 'does stuff' - And the results of the stuff it
does can be output to a text file. Cool 

So I can call this tool with my access app and pass all the necessary
parameter to make this thing work. 

The log and results etc are written to a text file and the bit I need is on
the last line of that text file - Success/Failure or otherwise

 

Does anyone have code to read the last line of a text file - the text file
grows and shrinks so a fixed position read won't work.

I do have an example (that use predictions about the line length etc) that
works about 50 percent of the time - It needs to work all the time

 

Many thanks in advance

 

DD

 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list