Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-05-11
12
Medium Priority
?
560 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
ID: 24361183

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

mx
0
 

Expert Comment

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

Author Comment

by:Zarbs
ID: 24361213
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Zarbs
ID: 24361216
mx:  What could "YourTableNameHere" be?
0
 
LVL 75
ID: 24361237
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
ID: 24361374
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
 

Author Comment

by:Zarbs
ID: 24361396
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 - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 24361421
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
ID: 24361456
Run-time error '2511':
The action or method requires a Specification Name argument.


0
 

Author Closing Comment

by:Zarbs
ID: 31580407
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
ID: 24361506
"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
ID: 24361517
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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

782 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