Reputation: 320
I have a table called "Tk20F7_agg" that I am trying to export as a .txt file with custom specifications. The code is below but when I run it, I get this error: "The Microsoft Access database engine could not find the object 'Tk2020181903#txt.'"
TempName01 = "Tk20" & Format(Date, "yyyyddmm")
ExportPath = DLookup("Export_Path", "OmniDB_system01")
Application.FileDialog(msoFileDialogSaveAs).Title = "Export Tk20 File7 (Testing)"
Application.FileDialog(msoFileDialogSaveAs).InitialFileName = TempName01 & ".txt"
intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
If intChoice <> 0 Then
strPath = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
End If
DoCmd.TransferText acExportDelim, "Tk20_File7_spec", "Tk20F7_Agg", TempName01 & ".txt", True
Any help on fixing this would be greatly appreciated!
Upvotes: 2
Views: 2223
Reputation: 622
I will also add for other readers - the key here is "with custom specifications".
Without those - - one can reconfigure a table/query and a saved export will work because it is just called by the object name.
Upvotes: 1
Reputation: 16015
In my experience, I've found that this particular (and rather misleading) error message can be produced when the structure of a query or table is modified and the associated Export Specification is not updated to reflect the changes.
To resolve the error, I would suggest exporting the target object 'manually' using the Export Text File wizard, and re-save the Export Specification.
Upvotes: 3