Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OutputTo function in a macro to export query to text file

Status
Not open for further replies.

appelq

IS-IT--Management
Dec 28, 2004
72
US
I have a simple query listing rows and columns.
I need to output query to a CSV file looking like:

"field1","field2","1234","field4"

Where all of the columns are text (even ones that look like numbers)

If I do this manually with the query open and using the menu option FILE / EXPORT...
I can get it to work fine.

I want to automate this for my user, so I created a Macro with an entry OutputTo
Type = Query
Name = Query1
Format = Text Files (*.txt)
File = C:\my documents\output.txt
Auto Start = NO
Template = blank
Encoding = blank

When I run this, the format had dashed line boxes around the data and is not a CSV.

How can I accomplish this?
I'd be glad to use VBA to write module, but the OutputTo function seems to be ALMOST what I need.
(I'm thinking the answer is in the field [Template] of the macro properties, but I don't know how to use that.

Any suggestions are welcome.

Thanks,
Chuck
 
Why not using the TransferText method (acExportDelim)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top