将多个*.csv文件导入access-将每个文件导入单独的表

将多个*.csv文件导入access-将每个文件导入单独的表,csv,ms-access,import,Csv,Ms Access,Import,我有一千多个文件要导入ACCESS数据库。 每个文件都需要导入到单独的访问表中。 它需要支持每天导入这些文件,因为波兰股票价格很高,所以每天晚上8点左右,我都会下载一个包含1000个*.csv文件的*.zip文件,我需要下次导入,以获取今天的价格 我需要更改一些设置,以便正确导入数据 下一件事是: 高级设置: 看起来怎么样 我不知道如何在VBA代码中编写这些高级更改。 在EXCEL中,我可以记录宏,然后使用我选择的设置查看语法,但在ACCESS中是否也可以这样做 我在网上找到了两个密码

我有一千多个文件要导入ACCESS数据库。 每个文件都需要导入到单独的访问表中。 它需要支持每天导入这些文件,因为波兰股票价格很高,所以每天晚上8点左右,我都会下载一个包含1000个*.csv文件的*.zip文件,我需要下次导入,以获取今天的价格

我需要更改一些设置,以便正确导入数据

下一件事是:

高级设置:

看起来怎么样

我不知道如何在VBA代码中编写这些高级更改。 在EXCEL中,我可以记录宏,然后使用我选择的设置查看语法,但在ACCESS中是否也可以这样做

我在网上找到了两个密码。 第一:

函数Impo_allExcel()

你能给我简单解释一下这些代码吗, 告诉我他们之间有什么区别, 如何将所需的设置合并到这些代码中, 或者换一个更适合我的。
非常感谢。

我非常确定您不应该将1000个文件加载到1000个不同的表中。我相当确定您需要将这1000个文件加载到一个表中,并添加一个额外的列来区分它们。此外,在您的选项中,您正在链接到它们。你为什么要这么做而不是导入它们呢?这是我第一个创建的数据库。我认为把每一只股票都放在自己的专栏里是明智的。你认为这个数据库应该是什么样子?如果所有股票都导入到一个大表中,那么“股票代码”列可以区分彼此之间的股票-不需要添加额外的列。Dir()查找目录中的下一个文件,因此循环使用my_文件似乎是正确的,但根据Nick的建议,将它们全部放入一个表中,正如你所说,ticker值区分了你的记录,因此不需要添加额外的列或表(假设你的每个csv文件都包含一个不同的ticker值)@Nick.McDermaid,我理解你们两个对我说的话——将这些数据放在一列中,在这个350万行的大表格中,使用每个股票文件中的股票代码字段/列来区分它们。好啊你们能不能从这两个代码中选择一个,并对其进行调整,以适应我的帖子上面给出的示例中的任务。是的,我的每个*.CSV文件在第一列中都包含一个不同的ticker(股票名称)值。
 Dim my_file As String
 Dim my_path As String

 my_path = "C:\Users\michal\SkyDrive\csv\bossa\mstcgl_csv"
 ChDir (my_path)              'why my_path is inside the brackets??

 my_file = Dir()

 Do While my_file <> ""      'is not empty (<> means not equal to), Excel VBA enters the value into
        'this line above doesn't work, when I'm trying to debug it with F8
   If my_file Like "*.csv" Then
     ' this will import ALL the *.CSV files
     '(one at a time, but automatically) in this folder.
     ' Make sure that's what you want.
    DoCmd.TransferSpreadsheet acImport, 8, "Contacts_AVDC_NEW", my_path & my_file
     ' what this above line says ? please explain.
    End If
    my_file = Dir()     ' what it means?
  Loop
  End Function
  Dim strPathFile As String
  Dim strFile As String
  Dim strPath As String
  Dim strTable As String
  Dim blnHasFieldNames As Boolean

  ' Change this next line to True if the first row in CSV worksheet has field names
  blnHasFieldNames = True
  ' real path to the folder that contains the CSV files
  strPath = "C:\Users\michal\SkyDrive\csv\bossa\mstcgl_csv"

  ' Replace tablename with the real name of the table into which the data are to be imported
  strFile = Dir(strPath & "*.csv")  'what this line means?

   Do While Len(strFile) > 0
       strTable = Left(strFile, Len(strFile) - 4)
       strPathFile = strPath & strFile
       DoCmd.TransferText acImportDelim, , strTable, strPathFile, blnHasFieldNames

   ' Uncomment out the next code step if you want to delete the
   ' EXCEL file after it's been imported
   '       Kill strPathFile

       strFile = Dir()    'what this means?
  Loop
  End Function