Private Sub Command11_Click()
Dim myfile
Dim mypath
mypath = "C:\Documents and Settings\u26g\My Documents\reusability\"
myfile = Dir(mypath & "*.txt")
Do
myfile = Dir()
'this will import ALL the text files (one at a time, but
automatically) in this folder.
DoCmd.TransferText
acImportDelim, "Tab_Spec", "Resuability_test", mypath & myfile
myfile = Dir
Loop Until myfile = ""
End Sub
"Bob" <(E-Mail Removed)> wrote in message
news:23b6001c45ed9$fda5c430$(E-Mail Removed)...
> The below code imports data from text files into a
> database. Unfortunately, the loop does not end and just
> keeps importing the data over and over and over again.
> Does anyone have any suggestions?
>
> Private Sub Command11_Click()
>
> Dim myfile
> Dim mypath
> mypath = "C:\Documents and Settings\u26g\My
> Documents\reusability\"
> Do
> myfile = Dir(mypath & "*.txt")
> 'this will import ALL the text files (one at a time, but
> automatically) in this folder.
> DoCmd.TransferText
> acImportDelim, "Tab_Spec", "Resuability_test", mypath &
> myfile
> myfile = Dir
> Loop Until myfile = ""
>
> End Sub
|