PhilipEwen
Registered User.
- Local time
- Today, 02:59
- Joined
- Jun 11, 2001
- Messages
- 81
Hi,
As you may have guessed by the sunject heading, i am trying to output the results of a query to excel.
The query is dynamic ( build by vba depensing on form entry criteria ) and what i am finding is that if i use the following:
DoCmd.OUtputTo acOutputQuery, txt_exportsql, "MicrosoftExcel(*.xls)","", True, ""
then it seems to call the filename the initial part of the query. This therefore truncates the query and i don;t get the results.
What therefore would you recommend the best way is to export to Excel based on the fact that i have a text string which contains the query ( sql="SELECT contacts.name etc etc )
I need to be able to save the excel spreadsheet in variable places, so the filename cannot be hard-coded into the VBA.
Thanks for your help.
As you may have guessed by the sunject heading, i am trying to output the results of a query to excel.
The query is dynamic ( build by vba depensing on form entry criteria ) and what i am finding is that if i use the following:
DoCmd.OUtputTo acOutputQuery, txt_exportsql, "MicrosoftExcel(*.xls)","", True, ""
then it seems to call the filename the initial part of the query. This therefore truncates the query and i don;t get the results.
What therefore would you recommend the best way is to export to Excel based on the fact that i have a text string which contains the query ( sql="SELECT contacts.name etc etc )
I need to be able to save the excel spreadsheet in variable places, so the filename cannot be hard-coded into the VBA.
Thanks for your help.