Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.Transfertext not working 1

Status
Not open for further replies.

mmogul

IS-IT--Management
Dec 1, 2003
218
US
I am attempting to use the docmd.transfertext command to export the contents of a table to a text file. I created the Export specification and it can be run successfully manually. But when I create the code for it, I get the following error:

"The text file specification does not exist. You cannot import, export or link using the specification."

My code is:

Code:
 DoCmd.TransferText acExportDelim, "Export-ExportDataToHyperion", sExportTable, sExportTargetFile, True]

I saw something that said this was a known bug addressed in Service Pack 1 which is: 14.0.6024.1000

However, I am running: 14.0.6117.5000 which appears to be a later version.

Appreciate any suggestions and / or workarounds.
 
It looks right. Maybe drop the hypen in the spec name?

 
sExportTable is the name of the table that is being exported -- in this case my table name is "tblGLTargetData"

sExportTargetFile is the path/file location of the exported file: in this case, lets say "c:\xyz.txt"

The last "]" is a type -- sorry -- pls ignore.
 
I was just using the root of the c drive as a test. Normally, I am writing it to a specific folder on the c drive.
 
Since the error is about the spec, I don't think the file system is returning an error , but you never know with Microsoft. Have you tried renaming the spec? Whatever your problem is seems to be with it.

 
Thanks. I have tried renaming the spec as well as recreating it. I can successfully run it manually through the Access menu(External Data / Saved Exports / select the spec and press RUN. But get the error in code.
 
Hey vbajock,

I have run repairs with no luck. I will check out the info in that link. Looks promising but won't get to it until tomorrow.

Thanks.
 
I must admit, whenever I'm exporting tables/queries to text files, I rely on this class.
It's much more configurable and is often more reliable in my experience.

hth

Ben

----------------------------------------------
Ben O'Hara
David W. Fenton said:
We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top