I created a test MS Access DB to export a table to Excel and a text file.
This works for Excel:
DoCmd.OutputTo acOutputQuery, "QryExportToExcel", _
acFormatXLS, XFile, False
For the text file, I created a specification and used this code
DoCmd.TransferText acExportDelim, "Mytable Import Specification", "mytable", "D:\myfolder\test1.txt", False
In the error message, I get "test1#txt".
The Microsoft Office Access database engine could not find the object
"test1#txt". Make sure the object exists and that you spell its name
and the path name correctly.
I tried creating test1.txt in the same path. To my surprise, this deleted the file which is already present.
Software: MS ACCESS 2007
The Microsoft Office Access databasse engine could not find the object "test1#txt". Make sure the object exists and that you spell its name and path name correctly.
This is a generic (and rather useless) error message that Access outputs in case anything goes wrong. One example would be a misspelled field name in the import/export specification.
You can get the "real" error message by trying the import operation "manually" in the Access user interface (rather than through code).
The question author reported the problem was "because I was using an Import Specification for Exporting a file."
They resolved the problem by using an Export Specification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With