Solved

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

Posted on 2009-05-11
12
544 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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 500 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

752 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