Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading text files in Access 2

Status
Not open for further replies.

techsupport3977

Technical User
Mar 7, 2005
56
US
How can I have the attached code read only the second line of the text file. This only seems to read the first line.


Code:
Dim strTextFromFile As String
Open "C:\Program Files\QM\QMD\flux.qma" For Input As #1
     Line Input #1, strTextFromFile
    
Close #1
 
Read two lines, and the last line read, will probably contain the second line

[tt]Dim strTextFromFile As String
dim intFree as integer
intFree = FreeFile()
Open "C:\Program Files\QM\QMD\flux.qma" For Input As #intFree
Line Input #intFree, strTextFromFile
Line Input #intFree, strTextFromFile

Close #intFree[/tt]

- or use a loop

[tt]Do While Not EOF(intFree)
Line Input #intFree, strTextFromFile
' do something with the info...
Loop[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top