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

Drew Wutka DWUTKA at Marlow.com
Mon Dec 1 16:34:01 CST 2008


Dim StrArray() as string
Dim strTemp as string
Dim f as long
F=freefile
Open "C:\yourfile.txt" for binary access read as f
Strtemp=space(lof(f))
Get f,,strtemp
Close f
Strarray=split(strtemp,vbcrlf)


I may have the 'get f,,strtemp' reversed, it might be 'get strtemp,,f',
a little tired today.  But the last line would then be
strArray(UBound(strArray))

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren D
Sent: Monday, December 01, 2008 4: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
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list