I've used DoCmd.transfer text with other projects to export a table in Access to a text file, and I am trying to do the same here, but with no success.
Code:
Public Function EXPORT_Inspections()
DoCmd.TransferText acExportFixed, "Export1", "Inspection_EXPORT", "c:/exp.txt", True, ""
End Function
I keep getting:
The Microsoft Access database engine could not find the object <name>. Make sure the object exists and that you spell its name and the path name correctly. (Error 3011)
I believe the statement is looking for the HTML table name, but you have identified that table name as a zero length string by putting the comma and the two double quotes at the end of your statement. Try this statement:
It's still not working, and I am trying to understand this error code and message without any success.
Run-time error '3011':
"The Microsoft Office Access database engine could not find the object 'test#txt'. Make sure the object exists and that you spell its name and the path name correctly.
Why is it trying to find 'test#txt'? I don't need it to find test#txt, I need it to export a table to a fixed width file. Anyone have any ideas?
I would suggest putting the C:\ back into the name of the output file: "C:\Test.txt" rather than just "test.txt".
I also notice you have changed the name, or changed what output specs you are using. At first it was Export1, but now the name is "RTM_Export" Did you just rename Export1 to RTM_Export, or did you create a new specification? Have you reviewed the specification closely?
Sorry about that. "RTM_export" is the table specification. I was trying to be as general as possible. I also changed the file back to c:\. Still the same error. It's so confusing- because it seems like it is trying to reference the file in the location instead of just exporting it.
Will, could you show us the export specifications (RTM_export). I would like to see a screen print for that if you know how, otherwise, just do a hand copy the best you can. Also, 4 to 5 sample records of the query or table you are trying to export, with the field names included. Suggest you select 4 or 5 records, copy them to the clipboard, then paste them into an Excel spreadsheet, then do a screen print of the Excel spreadsheet.
the field Deficiency is defined as a Long Integer, but the data in the table is TEXT. You need to go down each one of the fields in your table, and make the output specs match what is in the table.
Been reading this thread and it was interesting. Wog, did you already solve the problem? What codes did you use? I just want to look at them for reference. I'm trying to learn more by reading posts.