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

Importing a number of files a from set location

Status
Not open for further replies.

ApplePirate

Programmer
Dec 16, 2002
65
GB
Im sure this has been answered before, but i cant any threads today that will solve this easy problem.
I have a load of files which i recieve daily, i need to import them into a database, but i want to do it all in one go.
i have been tinkering with this peice of code but it only seems to import the first file and then stops:-

Function JGNoTelData()
Dim FileName As String

DoCmd.SetWarnings False
FileName = Dir("//supdox02/data/shared/bip/services/ecs_winback/loading area/*.txt")
If FileName <> &quot;&quot; Then
Do Until FileName = &quot;&quot;
DoCmd.TransferText acImportDelim, &quot;JG Data Import Specification&quot;, &quot;JG no tel data&quot;, &quot;//supdox02/data/shared/bip/services/ecs_winback/loading area/&quot; & FileName, False, &quot;&quot;
FileName = Dir()
Loop

End If
MsgBox (&quot;Import Complete!&quot;)
DoCmd.SetWarnings True

End Function

I know ive seen another bit of code on here which uses a count function based on the number of files in the directory e.g.
j = file count
for i = 1 to j
transfer text
next i


someone please help i cant go home early until ive done this
 
I have 1 difference in my examples.

yours
FileName = Dir()
mine
FileName = Dir
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top