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

Importing A .Txt File Based on Dates

Status
Not open for further replies.

wyvern621

Technical User
Nov 11, 2005
19
US
Happy Friday All!!!

I have some code that I've been using:

Function Import()


With Application.FileSearch
.NewSearch
.LookIn = "S:\PROJECTS\LINKAGE\OMSGROUP\Military\"
.SearchSubFolders = True
.filename = "*.txt"
.MatchTextExactly = True


End With

With Application.FileSearch
If .Execute() > 0 Then

For I = 1 To .FoundFiles.Count
DoCmd.TransferText acImportDelim, "AAFES Import Specification", Right(.FoundFiles(I), Len(.FoundFiles(I)) - InStrRev(.FoundFiles(I), "\")), .FoundFiles(I), False



Next I
End If
End With
End Function


What I would like to do is import only rows of a file based on a date range. The dates will always be in the same position of the table. Is it possible modifying this code?


Thanks in advance.

ChiTownDiva[ponytails]
 
Instead of importing the file, you could link it, and use a make table query to create a table of relevant rows.
 
Thanks Remou for responding...

It's based off of a Oracle table, so it's huge...I was trying to think of ways to get the data in without having to do a pass-through query...

ChiTownDiva[ponytails]
 
You cannot filter the data from the import you illustrate. The otions are linking the text file, reading the text file line by line (probably not a good idea), linking the Oracle table, a query of some description and something from this
I think that is all.
 
Anouther option would be to open the file, parse it as a text file, Either to anouther file or just insert the values in to your table.

Mike
 
mikej336
Would that be "read the text file line by line" or connections (ADO)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top