开发者

Macro required to add multiple CSV files into MSAccess 2003

开发者 https://www.devze.com 2023-04-04 05:21 出处:网络
Need help on two things 1)Macros to import multiple Csv files into Access. I have multiple Csv file around 60+, importing each and very file in MSAccess2003

Need help on two things

1)Macros to import multiple Csv files into Access. I have multiple Csv file around 60+, importing each and very file in MSAccess2003

will certainly take time. When googled got the following code but it is not working for me

Import_multi_csv()
Dim fs, fldr, fls, fl
Set fs = CreateObject("Scripting.FileSystemObject")
Set fldr = fs.getfolder("D:CSVFolder\")
Set fls = fldr.files
For Each fl In fls
    If Right(fl.Name, 4) = ".csv" Then
        DoCmd.TransferText acImportDelim, , "tblName", " D:CSVFolder \" & fl.Name, True
    End If
Next fl

2)Any Macro available to import specific coulmn from multiple csv files into MSAccess2003?

A开发者_如何学JAVAny help is greatly appreciated.


First of all I agree with 'HansUp', you are definately missing the \ which should follow the drive letter, secondly I believe it is always good to declare your variables correctly, you have set fs, fldr, and fls ok, but then it immediately asks for each fl in fls, it may not be 100% necessary but in my experience it would be good to declare as follows:

Dim fl as File

0

精彩评论

暂无评论...
验证码 换一张
取 消