Often it's simplest just to have your code create or modify a QueryDef
and export that. Other possibilities are:
-Have your code incorporate the SELECT statement into a SELECT INTO
(make-table) statement that uses an IN clause to specify the database or
file you want to export the data to.
-Recordset operations and automation (e.g. if exporting to Excel).
-Recordset operations and file I/O operations (if exporting to textfiles
or a custom format)