Problems when exporting from a query

  • Thread starter Thread starter David Cohen via AccessMonster.com
  • Start date Start date
D

David Cohen via AccessMonster.com

I have an Access 97 module which exports the result of a query to a CSV file. At present, I use the following (portion) code to do the export:

DoCmd.TransferText acExportDelim, "", "zzz-TEMP", filename, False, ""

where zzz-TEMP is a table created with a DoCmd.RunSQL on a query called "sqlCode".
This all works fine, but I'd like to bypass the temporary table creation if possible, and simply pass the query to the export commands, something like:

DoCmd.TransferText acExportDelim, "", sqlCode, filename, False, ""

But THIS doesn't seem to work. Access doesn't seem to like the query being passed directly to the Do.Cmd function, even though the help file seems to say it should.

Any suggestions?

Dave

*****************************************
* This message was posted via http://www.accessmonster.com
*
* Report spam or abuse by clicking the following URL:
* http://www.accessmonster.com/Uwe/Abuse.aspx?aid=7d63baa863674efda88d48b75dabafa6
*****************************************
 
Hi David,

RunSQL only works with action queries, and from what you say sqlCode is
a make-table query. TransferText works with tables or select queries, so
just change sqlCode into a select query that returns the same data it's
currently putting into the table it creates.
 
Back
Top