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

Importing DAT Files 1

Status
Not open for further replies.

ChiTownDiva

Technical User
Jan 24, 2001
273
US
Good Morning....

I'm trying to import multiple DAT files in a particular directory into an Access database using an import specification.

The problem is that sometimes there may be 10 or there may be 50--it varies.

After the file has been imported, it still can have the same name--that's fine, but I need to figure out a way to get each one in there.

A couple of people on tek-tips have helped me out--so far this is what I've got:


Function Import()
With Application.FileSearch
.NewSearch
.LookIn = "C:\valuerpt\test"
.SearchSubFolders = True
.FileName = "*.txt"
.MatchTextExactly = True


End With



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

For I = 1 To .FoundFiles.Count
DoCmd.TransferText acImportDelim, "Full Service Import Specification", "TempTable", .FoundFiles(I), True


Next I
End If
End With


I want to be able to just throw each file into Access, one right after the other--no appending--just import each file in the folder. "TempTable" just keeps getting replaced and that's not what we want.

Any help would be greatly appreciated.

Thanks in advance for your assistance.


ChiTownDiva [ponytails2]
 
An easy 'fix' wold be to append some value to "TmpTable". Exactly WHAT to append is, perhaps, more of a problem, depending on the persistance of the imported 'files'. You might juse use the string version of "I", as In "TempTable: & Trin(Str(I)), but this woould overwrite some of the files (tables) on each iteration. Some thought re the sequence should, however, permit a reasonable development of such a sequence.




MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top