Access Export Specifications

Access Export Specifications in MS Access

File export specifications are create in MS Access using a wizard. 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:

Access Export Specifications

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

Access Export Specifications

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

Access Export Specifications

 Click Export All

 When the Export Text Wizard opens click Advanced

Access 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 Specifications

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.

Access Export Specifications

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

Access Export Specifications

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:

Access Export Specifications

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.

Access Export Specifications

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

Access Export Specifications

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

Access Export Specifications

Contributed By: Janet Loch

Access DoCmd Tutorials:

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