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

Run-Time Error 3011 - Can't find file...

Status
Not open for further replies.

dmoonme

MIS
Jul 21, 2004
33
US
Hello,

I want to import about 100 csv files to Access table named "NY" But I keep on getting this error when running this code. Points to the DoCmd.TransferText line when debugging. PLEASE HELP!!!!

Code:
Private Sub Command0_Click()
Dim myfile


Do

myfile = Dir("c:\csv\*.csv")
DoCmd.TransferText acImportDelim, , "ny", myfile

myfile = Dir
Loop Until myfile = ""

End Sub
 
Try something like this:
Private Sub Command0_Click()
Dim myfile As String, mydir As String
mydir = "c:\csv\"
myfile = Dir(mydir & "*.csv")
Do Until myfile = ""
DoCmd.TransferText acImportDelim, , "ny", mydir & myfile
myfile = Dir
Loop
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the tip! It works so far. I am getting these Data Type conversion failure errors though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top