Automate File Export

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I automate exporting a table in comma delimited format?

The process works - How do I automate it so any user can create the file in
1 step?

Thanks
 
Put a command button on a form and use the Click event to execute the
TransferText method. For details on TransferText, see VBA Help.
 
I entered the following "On Click"

DoCmd.TransferText acExportDelim,,EDI,"c:\itl\Maersk EDI.txt",,,,

I keep getting compile and syntax errors.

I have tried various itterations - no go.

ALSO: I need to export this table "EDI" as comma delimited with no text
qualifiers - How do I set that parameter?

Please help.

Thanks
 
The table name needs to be in quotes
DoCmd.TransferText acExportDelim, ,"EDI","c:\itl\Maersk EDI.txt"

You can set up an Import/Export Specification. To do that, go through the
process manually.
In the database window, highlight the table
From the menu - File, Export
Select Text Files in Save As Type
Give it a file name to Save to
Click on Export Text wizard
Click on Advanced
From here you can set the export up however you need it.
When you have the formatting like you want it, click Save As.
Enter a Name and save it.

Now you can add the Specification Name argument to the Transfer Text and it
will use it to do the formatting.
DoCmd.TransferText acExportDelim, "Spec Name Here","EDI","c:\itl\Maersk
EDI.txt"

You will get the
 
Back
Top