为什么我在 ms-access 传输文本导出时收到运行时错误"3011"?



MS Office 365 专业增强版,Access 2007 - 2016

尝试/失败让 DoCmd.TransferText acExportDelim 工作。 这是代码...

Public Sub Dump_TaskDB_TXT()
 DoCmd.TransferText acExportDelim, "Export-BurnDownMetrics", "BurnDownMetrics", "C:UsersdgauthieDesktopBDM.txt"
End Sub

我得到...

Run-time error '3011'
The Microsoft Access database engine could not find the object 'BDM#txt'.  
Make sure the object exists and that you spell its name and the path
name correctly.  (etc...) "

不,"BDM#txt"中的"#"不是拼写错误。 不知道为什么它用"#"替换".",但也许这是关于问题所在?

当我的目的是创建文件时,为什么它会抱怨无法"找到"文件? 我认为在尝试导出到该文件之前,该文件不应该存在。 是的? 不?

我不认为出口规范有什么问题。 当我创建它时,它工作正常。

这篇文章的附录:导出规范显示在 MSysIMEXSpec 中,其中包含以下列/值:

DateDelim:  /
DateFourDigitYear:  -1
DateLeadingZeros:  0
DateOrder:  2
DecimalPoint:  .
FieldSeparator:  |
FileType:  1252
SpecId: Export-BurnDownMetrics
SpecType:  1
StartRow:  0
TextDelim:  "
TimeDelim:  :

我在网上搜索,每个人都有不同的解决方案,但对我不起作用。因此,对于所有必须处理这个愚蠢错误的灵魂,在DoCmd.TransferText等之前,添加到您的代码中:

如果 Dir(无论什么都是您的文件名(<> " 则

    Kill whateverisyourfilename
End If

确保在"whateverisyour文件名"中指定了正确的目录。

让我

发疯,然后我删除了架构.ini文件,没有进一步的问题。

mlocorders = mDataLoc + "QBorders.csv">

DoCmd.TransferText acExportDelim, , "QBImportQuery", mlocorders, True

最新更新