Export Filtered Subform to Excel

Felix314

Registered User.
Local time
Today, 10:26
Joined
Jan 9, 2013
Messages
22
Hello everyone,

Just wondering if anyone can help solve this problem. This forum is awesome, and I thank all who can help. It is much appreciated.

So, here's my issue...
I would like to export a filtered subform on a main form to an excel file by clicking a command button with VBA code.
The subform is filtered by typing in a text box to filter a specific field. The subform's record source is a query generated from a few tables.

Is this possible, or do I need to try some other method?
 
If you have your query stored as an object in your database, you can do it like this (assuming the Excel file is located in the database directory):

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "NameOfYourQuery", CurrentProject.Path & "\YourExcelFile.xlsx"

Note that this method creates your Excel file if it doesn't exist but if so, it will append a new spreadsheet.
 
You may use MultiLevelExporter add-in for this.
It can export data of the filtered subform into MS Excel.
 

Users who are viewing this thread

Back
Top Bottom