Home  Fees/Services  Access Templates  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

DoCmd Examples - Access VBA
Access Export Specification Wizard

Docmd Macro VBA Example

DoCmd AddMenu
DoCmd ApplyFilter
DoCmd CancelEvent
DoCmd Close
DoCmd CopyObject
DoCmd DeleteObject
DoCmd FindRecord
DoCmd FindNext
DoCmd GotoControl
DoCmd HourGlass
DoCmd Min/Max/Restore
DoCmd OpenForm
DoCmd OpenQuery
DoCmd OpenReport
DoCmd OutputTo
DoCmd RunSQL
DoCmd SendObject
DoCmd TransferDatabase
DoCmd TransferText

Create Export Specs


Microsoft Office:
  MS Access 2003
  Access 2007
  Access 2010
  Access 2013

Access Export Specifications

File export specifications are create in MS Access using a wizard.

Are you just starting out on your quest for a small business database? Need some advice or someone to bounce ideas off of? We are happy to chat with you to discuss options to your situation.

Are you looking for an MS Access template database? We have many for sale in our Access Template and Examples Software section.

You can define a file export format specification, name that specification, and then use it to automate exporting table or query information to a file in specified format. Use the export specification wizard to create the specifications for the DoCmd.TransferText macro and visual basic function.  Finding your way to the specifications is one of Access's more obscure features.

First create the table or query that you wish to export.  Our example is a simple Employee table:

 When you have created the table or query open it up then select File/Export form the menu bar.

Export Specifications Fixed Width

When the browse box comes up navigate to basically any directory, enter a file name, and choose the Text Files type.

 Click Export All

 When the Export Text Wizard opens click Advanced

Text File Export Specifications

You are now looking at Export Specification wizard.  Here you will define the format for the file that you wish to create. 

Access Export Wizard

The default is a comma delimited file.  For this example I am going to select Fixed Width.  You can see that it fills in the start and length values based on the table definition.

Import Specifications Wizard

 Now select Save As, name your specification and click OK.

Access Output Specifications File

Now in code you can use this saved specification in the TransferText command as follows:

txtExportName = \Example\Employee.txt"

DoCmd.TransferText acExportFixed, "Employee Export Specification", "Employee", txtExportName

 The command above is saying use the format in the Employee Export Specification specification on the data in table Employee to create the file named in variable txtExportName.

 The result is this simple text file:

Now if you ever need to go back and modify that specification you have to take the long road to get there.  Basically act like you are starting all over again to create a specification but when you get to the Export Specification wizard click the Specs button.

TransferText Specifications

 You will be presented with a list of all the specification that are defined in this database:

CSV Export Specifications

Select the one you want and click Open.  You are now back at the specification you defined and saved originally.  Modify away!

Export Specs

Contributed By: Janet Loch

New! Download a running example of the Docmd.TransferText method using an export specs file.

Microsoft Office:
MS Access 2003
Access 2007
Access 2010
Access 2013

A Blue Claw Software Design Template:

Personnel Agency Access Template

A Blue Claw Database Design Article:

ODBC Links To Other DB Systems

Blue Claw Database Design Downloadable Tutorial:
How To Fill Fields From Combo Box  

Contact Information

Copyright 2000-2018 Blue Claw Database Design