query to excel

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

Guest

i have a query that asks for a data when run. it then displays jobs required
for the entered date.

i want some kind of button on a form or macro that runs the query then saves
it or exports it to an excel document. how do you do this?


thanks
 
Put a command button on a form to run the query. Use the On Click event to
execute the code.

If you want to export it to Excel, see then TransferSpreadsheet method in VB
Editor Help.
You can use the TranferText method to save it as a text file.
If you want to save it in Access, you will have to save it as a table. For
that, you will want to make it an append query. You can use a make table
query, but I avoid them because they use default field sizes that are always
too large. If I want to get rid of old data in a table and recreate the
table, I always delete the data in the old table and use an append query to
put the data in the table.
Another little tip is to use the Execute method to run an action query
rather than the RunSQL method. The Execute method is about 5 times as fast
as RunSQL.
 
Back
Top