我正在運行 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
uj5u.com熱心網友回復:
我相信 Parfait 告訴您的是保存的匯入/保存的匯出與匯入/匯出規范有很大不同。您正在嘗試將保存的匯出放入需要規范的 TransferText 引數中。您可能在某個時候進行了匯出并將這些步驟保存為已保存的匯出。
如果您真的對使用此匯出的規范感興趣,那么您將希望通過匯入您想要的格式的現有文本檔案來創建一個。請參閱上面的凍糕答案。
否則,只需將規范引數留空即可匯出查詢。
uj5u.com熱心網友回復:

匯出文本向導

To date, there may not be any other GUI way to adjust these saved specifications. They are stored in system tables, MSysIMEXspecs and MSysIMEXColumns. Again, do not confuse above text file specific method for the generalized external data methods: ImportExportSpecifications and DoCmd.RunSavedImportExport.
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/449932.html
