Export subform results to Excel

jimster68

New member
Local time
Today, 09:56
Joined
Feb 27, 2007
Messages
6
I have built a main form that includes controls to filter/search records from a subform based on a query. The query pulls data from multiple tables. I want to create another command button in the main form to export the filtered results from the subform to an excel spreadsheet. I have the following code but it pulls all of the data from the query, not the filtered results.

Private Sub cmdExcel_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "q_Server_Data", "c:\temp\test1.xls"

End sub

How can I change this to include only the data from the filter/search in the subform?

Thanks,
Jim
 
Export subform results to Excel - solution

Well I discovered something that works.

DoCmd.OutputTo acOutputForm, "frm_Server_Data", acFormatXLS, _
strPath & "\ServerData.xls" ', AutoStart:=-1

This outputs the filtered results from the subform to the spreadsheet. :)
 
Hi,
There is an Access add-in MultiLevelExporter (find it on the web) that does this task for you, i.e. it exports data from the filtered subform into the Excel.
Norbert
 
As this thread was posted seven and a half years ago, I'm pretty sure the OP is no longer dealing with this issue.
 

Users who are viewing this thread

Back
Top Bottom