VBA 运行时错误 3625 文本文件规范 Export_Spec 不存在

用户2576682

我正在运行 Access 2016。我正在尝试将查询结果导出到文本文件中,但我不断收到错误 3625 未找到规范。我创建了规范,如果我运行规范,它会按预期工作。我尝试使用引号而不是导出规范,但文件上没有格式。我在网上找到的解决方案是说使用高级选项卡来定义格式,在我的 Access 2016 版本上,规范创建过程中没有高级选项卡。我已经逐步完成了该过程,并且所有目录和文件名都已正确创建。错误发生在以下行:DoCmd.TransferText TransferType:=acExportDelim, SpecificationName:=strExportSpec, TableName:=strQueryName, FileName:=strFullName, HasFieldNames:=True

规格说明

任何帮助表示赞赏。

Private Sub Export_Click()
Dim strFileName As String
Dim lFileName As Long
Dim strCurrentDate As String
Dim strFormattedDate As String
Dim dtCurrentDate As Date
Dim strDir As String
Dim strFullName As String
Dim strExportSpec As String
Dim strQueryName As String
Dim strYear As String
Dim strMonth As String
Dim strPath1 As String
Dim strPath2 As String


strYear = Format(Date, "yyyy")
strMonth = Format(Date, "mm")

'Check if Directory Year exists
strPath1 = "C:\Users\Owner\Google Drive\Employment\Mass Unemployment\" & strYear


'Check if year exists
If Dir(strPath1, vbDirectory) = "" Then
    MkDir strPath1
End If
'Create

strPath2 = "C:\Users\Owner\Google Drive\Employment\Mass Unemployment\" & strYear & "\" & strMonth & "\"

If Dir(strPath2, vbDirectory) = "" Then
    MkDir strPath2
End If

strCurrentDate = Date
strFormattedDate = Format(strCurrentDate, "mmddyyyy")
lFileName = InputBox("Enter Week Number", "Enter Week Number")

strFileName = strFormattedDate
strFullName = strPath2 & strFileName & ".txt"
strExportSpec = "Export_Spec"    ' error 3625 export spec does not exist
strQueryName = "qryUnEmployment"

DoCmd.TransferText TransferType:=acExportDelim, SpecificationName:=strExportSpec, TableName:=strQueryName, FileName:=strFullName, HasFieldNames:=True 
 
End Sub
普拉达科塔

我相信 Parfait 告诉您的是保存的导入/保存的导出与导入/导出规范有很大不同。您正在尝试将保存的导出放入需要规范的 TransferText 参数中。您可能在某个时候进行了导出并将这些步骤保存为已保存的导出。

如果您真的对使用此导出的规范感兴趣,那么您将希望通过导入您想要的格式的现有文本文件来创建一个。请参阅上面的冻糕答案。

否则,只需将规范参数留空即可导出查询。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在VBA中打开Excel文件:运行时错误'462':远程服务器计算机不存在或不可用

VBA运行时错误-2147188720对象不存在

SQL表不存在时VBA中的运行时错误

运行时错误“3075”VBA:检查表中是否已存在文件

VBA在运行时找不到ElementById。检查时存在元素,但VBA引用时不存在

第二次运行VBA代码时,出现“运行时错误462:远程服务器计算机不存在或不可用”

宏只在运行时错误 462 之前运行一次 excel vba:远程服务器不存在或不可用

运行时错误“1004”:字段“活动”不存在

在运行时不存在错误jar

路径/文件访问错误运行时 75 - VBA

为什么会出现运行时错误58-在VBA中复制文件时文件已经存在?

VBA运行时错误9:下标超出范围,无法将相似的工作表转换为文本文件

如何让Excel运行保存在文本文件中的VBA代码?

错误:文本搜索配置不存在

如果文件不存在,则防止错误

使用Excel VBA写入文本文件的两种方法:Microsoft标准库与Microsoft脚本运行时

Excel VBA-如果文本框值在范围内不存在,则显示错误消息

当文件不存在时,execl 错误 ==“文件存在”

AWS EMR:文件存在但错误提示文件不存在

不断获取文件不存在错误(即使存在目录)

使用Python将硒结果/输出在运行时保存在文本文件中

如何扫描文本文件中的字符串,并在字符串不存在的情况下运行代码?

Excel VBA 日期保存 - 运行时错误 75 路径/文件访问错误

HttpClient在运行时不存在

运行时错误'340'vb 6.0,控制数组元素'3'不存在

出现错误“不存在Java运行时”,我该如何解决?

Docker错误:从Win10运行时找不到或不存在容器命令

连接到MySql的Scala Play显示运行时错误“表'token'不存在”

Cyrus Sieve运行时错误声明邮箱不存在