Select records 'INTO' text file

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

Guest

I'd like to automatically dump my query results into a text file (including
column headers).

Anyone know a way I can accomplish this?

Thanks!
 
Try using the TransferText action to export your query.
There is an option to include the field names.
 
Well, I'm not good in VB at all - really. So, that being said.....I assume
there is no way to do this just via the query, as if I were selecting records
and using the INTO command to write them to a table, only writing them to a
text file?

Here's basically what I'm doing and the results I want to be automatically
exported...

Select <field1>, <field2>, <field3>, <field4>
From <table>
Where <field2> Between '<x>' and '<y>'
And <field4> In('<criteria1>', '<criteria2.'>)
 
1. Save the query.
2. Create a new marco.
3. Choose the TransferText action.
4. In the lower pane in macro design, fill in the lines.
5. Save the macro.
 
Well, I'm not good in VB at all - really. So, that being said.....I assume
there is no way to do this just via the query, as if I were selecting records
and using the INTO command to write them to a table, only writing them to a
text file?

You don't really need VBA code (though it's NOT hard in this
instance); you can use a Macro to export a saved Query to a text file.
As Allen suggests, the TransferText action is the key; see the online
help for it, and call it from either a macro or from code.

You cannot do it in a simple Query. The query language simply does not
include that as an option.

John W. Vinson[MVP]
 
Thanks, that worked great!

Allen Browne said:
1. Save the query.
2. Create a new marco.
3. Choose the TransferText action.
4. In the lower pane in macro design, fill in the lines.
5. Save the macro.
 
Back
Top