Solved

What is syntax to export a txt file from Access 2007 database

Posted on 2009-05-11
12
533 Views
Last Modified: 2012-05-06
I wish to export a text file to disk from the results of a query

I am using the syntax:
DoCmd.TransferText acExportFixed, "Export-600-01 C Type", , "R:\Despatch\PBLink\600-01 C Type.TXT", False

This message appears:
Run-time error '2495':
The action or method requires a Table Name argument.

Where have I gone wrong?  Is there a better way?
0
Comment
Question by:Zarbs
  • 7
  • 4
12 Comments
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility

DoCmd.TransferText acExportFixed, "Export-600-01 C Type", "YourTableNameHere" , "R:\Despatch\PBLink\600-01 C Type.TXT"

mx
0
 

Expert Comment

by:raju1
Comment Utility
Try this:
DoCmd.TransferText acExportDelim, "Standard Output", _
    "External Report", "R:\Despatch\PBLink\600-01-C-Type.TXT"
0
 

Author Comment

by:Zarbs
Comment Utility
mx:  I am not sure whether I should be using the DoCmd.outputto command

raju1: I definitely want file to be fixed length - not delimited
0
 

Author Comment

by:Zarbs
Comment Utility
mx:  What could "YourTableNameHere" be?
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Well ... in your post:

DoCmd.TransferText acExportFixed, "Export-600-01 C Type",   , "R:\Despatch\PBLink\600-01 C Type.TXT",
       the table or query name goes between the two commas ^^^

mx                          
0
 

Author Comment

by:Zarbs
Comment Utility
As soon as I change line to read:

DoCmd.TransferText acExportFixed, "Export-600-01 C Type", "600-01 C Type", "R:\Despatch\PBLink\600-01 C Type.TXT"

The following message appears:

Run-time error '3625':
The text file specification 'Export-600-01 C Type' does not exist.  You
cannot import, export, or link using the specification.

This is the name used in the wizard - see screenshot
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Zarbs
Comment Utility
Won't upload screen .... I don't know whats wrong now .... I just loaded explorer 8 so probably the latest security 'fix' from microsoft which stops everything working
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
Comment Utility
Try this with no Specification

DoCmd.TransferText acExportFixed, , "600-01 C Type", "R:\Despatch\PBLink\600-01 C Type.TXT"

and this is the general syntax:

DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName

mx

0
 

Author Comment

by:Zarbs
Comment Utility
Run-time error '2511':
The action or method requires a Specification Name argument.


0
 

Author Closing Comment

by:Zarbs
Comment Utility
DoCmd.TransferText acExportFixed, "600-01 C Type Export Specification", "600-01 C Type", "R:\Despatch\PBLink\600-01 C Type.TXT"

Thanks
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
"Grade:  A - "DoCmd.TransferText acExportFixed, "600-01 C Type Export Specification", "600-01 C Type", "R:\Despatch\PBLink\600-01 C Type.TXT"

Thanks "

Always a pleasure Zarbs ...

mx
0
 

Author Comment

by:Zarbs
Comment Utility
mx

I'm always pleased you are about to prod me in the right direction.

I can go off happily to play squash without worrying about it

Cheers
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now