Exporting a query to excel

woknick

Registered User.
Local time
Today, 03:54
Joined
Sep 25, 2004
Messages
85
I have a form that allows users to specify the information they want to be displayed on a subform. I have used the below code (simpilified for example purposes) to create the SQL string and sent it to the subform for display. I would like to have an export to excel button to export the recordSource to a spredsheet. is this possible?


Me.frmsubClients.Form.RecordSource = "SELECT DISTINCT New_Client_Table.Account_Number" & BuildFilter

Thank you in advance.
 
Here is the output code I am using

DoCmd.OutputTo acOutputForm, "frmsubClients", acFormatXLS, "Test.xls", 0

The problem lies in the subforms recordsource. My subform on the main search form updates as the user selects new criteria, but when I export to excel it only exports the records source of the frmsubClients, not the records that are visible within the search form.

Any ideas?
 

Users who are viewing this thread

Back
Top Bottom