CSV导入错误-涉及的日期/时间

CSV导入错误-涉及的日期/时间,csv,ms-access,vba,ms-access-2010,Csv,Ms Access,Vba,Ms Access 2010,我有以下格式的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时(它

我有以下格式的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
):


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

请尝试从数据文件中删除磅字符(“#”-您会这样称呼它们吗?)

我想您知道,当通过
DoCmd.TransferText
方法导入CSV数据来创建表时,Access(Jet)会根据在扫描导入数据的第一行时找到的数据来分配列数据类型。如果一列有数字数据,Jet将为该列指定
数字
数据类型、日期格式的数据获取
日期时间
列等


在您的情况下,Jet由于“#”字符而无法确定“日期”列的数据类型,因此将该列指定为(相当通用的)
Text
数据类型。

我将尝试并尽快报告。效果非常好。谢谢@我很高兴能帮上忙!
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