You may find this example:
http://www.dbforums.com/6390529-post84.html
helpful.
All you do is save any of your queries with a prefix of "Export" (or change the criteria), and it let's the user view/export the query as the query name (including adding the date format), and the type of export (dbf, xls, csv). The view opens up in a form view so you code events around the form. It uses the same docmd.transferspreadsheet command and some simple tricks.
Otherwise you need to create a variable and include the name of the query in your variable similar to jepi's example.