I've got about 100 CSV files that I'm trying to import them into Access and then rename the tables based on the file names.
Here is the code I've found but the "tablename" should be my file name. however, I can't get it to work as I'm new to scripting.
Function Import_multi_csv()
Dim fs, fldr, fls, fl
Set fs = CreateObject("Scripting.FileSystemObject")
Set fldr = fs.getfolder("D:Files\")
Set fls = fldr.files
For Each fl In fls
If Right(fl.Name, 4) = ".csv" Then
DoCmd.TransferText acImportDelim, , "TableName", "D:Files\" & fl.Name, False
End If
Next fl
End Function
Also, I have three columns in my files and I want the third column to be imported as a double.
Any help will be appreciated.