我有以下格式的 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
它将第一个字段作为字符串而不是日期导入。我希望更改文本文件的格式(首选)或更改脚本以适应作为日期/时间对象导入。