0
我有一些vba代碼,我試圖用來導出查詢的結果,並且每次我的代碼嘗試導出時它會拋出一個錯誤, Run-time error '3073': Operation must use an updateable query
,我不知道爲什麼。即使使用相同的規格,導出其他表和查詢也可以正常工作。任何想法,我遇到了什麼樣的問題?通過它擊中的DoCmd.TransferText
線問題確認步進運行時錯誤'3073':操作必須使用可更新的查詢
Public Function exportJobDetailRecs(dateStr As String)
'Docmd.TransferText(acexport,specName,TableName, FileName,HasfieldNames,HTMLTableName)
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(directory + CStr(dateStr + "_OrderStatus_jobdets.txt")) Then
Set temp = fso.createTextFile(directory + CStr(dateStr + "_OrderStatus_jobdets.txt"))
temp.Close
Else
MsgBox "It looks like you have already run the report (or partially run the report) today. Please Remove all remnants of the text output files and re-run." + vbNewLine + directory + CStr(dateStr + "_OrderStatus_jobdets.txt"), vbOKOnly, "Previously Run exports"
Exit Function
End If
Dim fnameStr As String
fnameStr = CStr(dateStr + "_OrderStatus_jobdets.txt")
DoCmd.TransferText acExport, _
"JobDetail", _
"2_JobDetail", _
directory + fnameStr
exportJobDetailRecs = fnameStr
End Function
我不認爲這是查詢本身,因爲右鍵單擊具有相同的規格導出查詢工作得很好,但通過訪問查詢生成的SQL是here
TransferType acExport可能需要是以下某個http://msdn.microsoft.com/en-us/library/office/ff194227.aspx。你的查詢看起來像一個選擇,所以我認爲這個錯誤可能是誤報。 –
看起來我是一個白癡。我嘗試了WORD acExport,而我需要與acExportDelimited相對應的編號。作爲答案提交,我會標記你 – PsychoData
謝謝!在你的防守中,這是一個糟糕的錯誤,我已經得到了這個。 –