Question Export "Query or Report" to a "Delimited Text File"

hawzmolly

Registered User.
Local time
Today, 15:47
Joined
May 25, 2009
Messages
14
A little background. I need to export the results of a query I use to build a report. For Print Master software I need the "Field Names" in the text file as well as the data for a Mail Merge in Print Master (PM).

The PM error: "The field name information in the file you have specified is missing or not correctly formatted. The first line of the file must contain the database field names. Make sure the "Export Field Names" (or similar) option is selected in the program from which you are exporting data."

Trouble is, when trying to export the report or query, Access has no "Export Field Names" option. It works if I first export to Excel and then from Excel to "txt" then to Printmaster. I would like to eliminate the Excel step. Therefore, how do or can I get Access Export to transfer the "Field Names" along with the field data?
 
If using Access 2003 :-

File>Export>Enter File Name>Save as Type>Text Files>Export All>Delimited>Next>Include Field names on First Row>Next>Finish
 
Have you tried looking at creating a MACRO that uses TransferText which gets delimited and will show the FieldNames.

In your version of Access Create a Macro and at the Top you need to select Show All Actions then in the drop down you will find what you need and then complete the bottom section Aaction Arguments and save the Macro.
 
I have Office 2010. I have tried to find "TransferText" in Access. Even with "Show All Actions" turned on the "TransferText" does not show up. I even started a new macro with "Show All Actions" on to no avail.
 
OK in 2010 they have changed it to ImportExportText then you have the same options as previously mentioned.

You still need to select Show All Actions.
 
I found the "ImportExportText" in Access 2010. However, when I click on this to add it to the macro I get "Unsafe Action". The macro will not work. In Options I have "Enable all macros" checked as well as I have added the location to "Trusted Locations". This MS security is BS. I am the one to decide my risk not MicroSoft. Anyway, how do I get past the "Unsafe Action"? :banghead::banghead:

TIA
 
Stop using macros. This is a single line of VBA code, I think you can handle it. You'll even get intellisense to help you get the arguments in the correct order.
 
Thats a good idea Pat.

In the VBA screen you can add a sub or function and if you start the line of code with DoCmd. it will then give you the list that macros will provide so you can then search down for ImportExportText each part then separate with a comma to move the next part.
 

Users who are viewing this thread

Back
Top Bottom