0
我有以下格式的CSV文件:CSV導入錯誤 - 日期/時間參與
Dates,Open,High,Low,Close,Volume
#2010-01-03 15:01:00#,1.1648,1.1648,1.1622,1.1646,8
#2010-01-03 15:02:00#,1.1648,1.1648,1.1648,1.1648,1
#2010-01-03 15:03:00#,1.1648,1.1648,1.1648,1.1648,2
編輯:要明確的,那就是YYYY-MM-DD
。
當我將其導入到Access 2010中使用以下腳本(它在D:\Data\Processed
):
Dim strFolderPath As String
strFolderPath = "D:\Data\Processed\"
Dim StrFile As String
StrFile = Dir(strFolderPath & "*.txt")
Do While Len(StrFile) > 0
'MsgBox (objF1.Name)
DoCmd.TransferText acImportDelim, , StrFile & "draft", strFolderPath & StrFile, True
'DoCmd.TransferText acImportDelim, strFolderPath & objF1.Name, False
'DoCmd.TransferText acImportDelim, "TextImportSpecs", "tblImportedFiles", strFolderPath & objF1.Name, False
'DoCmd.TransferText _
'TransferType:=intImportType, _
'SpecificationName:=strSpecification, _
'TableName:=strTable, _
'FileName:=strPath & strFile, _
'HasFieldNames:=blnHasFieldNames
'strFile = Dir
Name strFolderPath & StrFile As "D:\Data\Done\" & StrFile 'Move the files to the archive folder
StrFile = Dir
Loop
它進口的第一個字段作爲一個字符串,而不是一個日期。我會很感激改變文本文件格式(首選)或改變腳本以適應作爲日期/時間對象導入。
我會嘗試並儘快報告。 – 2013-05-11 16:05:29
工作就像一個魅力。謝謝! – 2013-05-11 16:27:52
@HameerAbbasi很高興能幫到你! – 2013-05-12 05:19:20