Greetings,
I created a form whereby users answer to parameter values and press ‘Run Query” and pass those parameter values to a report.
I used the following for ‘Run Query’ button:
DoCmd.OpenReport “MrReportName”, acViewPreview
The above works fine. What I’m trying to achieve is the following:
Once users previewed the filtered data, I want them to be able to export the result to excel. To achieve this, I created another button ‘Export’ and use the following syntax:
DoCmd.OutputTo acOutputQuery, “MyQueryName “, acFormatXLS, , True
The above works well. The problem is that it doesn’t reflect the filtered data (the report displays everything).
I also attempted to use the built-in export to excel wizard for the command button, but I did not see any option to export data to excel.
TIA,