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\LISLEPD\EFTOFS5617MONMEMDD150201T1620042.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
Stephen RoesnerAnalysisAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
try this


   Open "C:\ERPDP\NationsIn\LISLEPD\EFTOFS5617MONMEMDD150201T1620042.txt" For Input As #1
   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
0
PatHartmanCommented:
If the file is formatted as a "list" (with or without headers), you can use TransferText to link to it and work with it as if it were a table.  The only time you would need to use the input method is if the file were a non-standard format such as a transaction file used in EDI (Electronic Data Interchange) where companies used very complex but standardized record formats.  Each "record" is a completely different format from other records.  So it might require reading 20 individual records of different "types" and putting them all together to get the name and address of a client.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stephen RoesnerAnalysisAuthor Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.