Stephen Roesner
asked on
How do I search a specific space in a text file for specific data
I use the following code to open a super large text file
so I can rewrite it to a smaller size for import.
This code works great.
Now I have another even larger text file that I need data from
I have determined that if I can say something like
(only grab the records where col 92-93-94-95 = 2014)
and write it to file 2 then I can narrow it down to the records I need
is this possible?
'this converts the large file to an Access importable file
Open "C:\ERPDP\NationsIn\LISLEP D\EFTOFS56 17MONMEMDD 150201T162 0042.txt" For Input As #1
Open "C:\ERPDP\MONMEMD.txt" For Output As #2
Do Until EOF(1)
Line Input #1, str
If str & "" <> "" Then _
Print #2, Left(str, 406)
Loop
Close
so I can rewrite it to a smaller size for import.
This code works great.
Now I have another even larger text file that I need data from
I have determined that if I can say something like
(only grab the records where col 92-93-94-95 = 2014)
and write it to file 2 then I can narrow it down to the records I need
is this possible?
'this converts the large file to an Access importable file
Open "C:\ERPDP\NationsIn\LISLEP
Open "C:\ERPDP\MONMEMD.txt" For Output As #2
Do Until EOF(1)
Line Input #1, str
If str & "" <> "" Then _
Print #2, Left(str, 406)
Loop
Close
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wow never dawned on me to link since I never needed to do it in the past - great solution - I can link to it do what I want with it and it doesn't add an ounce to the db - great idea, simple but great. I do feel stupid LOL.
thank you.
thank you.
Open "C:\ERPDP\NationsIn\LISLEP
dim strFind as string
strFind="2014"
Open "C:\ERPDP\MONMEMD.txt" For Output As #2
Do Until EOF(1)
Line Input #1, str
If Instr(str,strFind) Then
Print #2, Left(str, 406)
end if
Loop
Close