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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading text file - skip certain lines

Status
Not open for further replies.

air1access

Technical User
Jan 27, 2008
123
US
I have a text file that is exported from our mainframe system everyday.. The problem this file is some-what formatted... I need to fix the format so its a clean file for importing into access...

I need for it to read each line, and only print the line if it meets certain criteria... Where I'm hung up is when a line is completely blank & there is no text what so ever on that line.. How do I get the code to "skip" these lines and move to the next line...???

Below is what I'm working with...
Any suggestions or examples..??
Thanks in advance..!!
air1access

Do Until EOF(1)
Line Input #1, strLine

'E or S Task Types
If Left(strLine, 2) = "E " _
Or Left(strLine, 2) = "S " Then
strType = strLine
Print #2, strType

'This line is the Task intervals
Line Input #1, strLine
If Left(strLine, 7) <> " " Then
strType = strLine
Print #2, strType

'This line is the Task Accomplish
Line Input #1, strLine
If Left(strLine, 1) <> " " Then
strType = strLine
Print #2, strType

'This line is the Planning Notes
Line Input #1, strLine
If Left(strLine, 1) Like Space(1) Then
strLine.SkipLine
ElseIf Left(strLine, 1) <> " " Then
strType = strLine
Print #2, strType

End If
End If
End If
End If

Loop
 
what I would do is create a linked table to this file and create queries for each line type



Code:
Select * 
from linkedtable
where left(field1name,1) in("e","s")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top