开发者

Programmatically import CSV data to Access

I have an Access database and the source of data comes from generated CSV files. I'd like to have an easy way for the users to simply select the data file and 开发者_JS百科import it. Import should append the existing data to the data already in the data table. Is there a way in Access to create a file selector and import using saved CSV import settings that are already in the file?


You can use the built in file dialog to do this (access 2003 and later)

Dim f    As Object
Set f = FileDialog(3)
f.InitialFileName = "c:\InCommingData\"
f.Filters.Add "text", "*.csv"

If f.Show Then
   DoCmd.TransferText acImportDelim, "mySpec", "Your Table", f.SelectedItems(1)
End If


This seems to work. How to use the Common Dialog API in a database in Access 2003 or Access 2007

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜