Access report: export to file (using filter criteria)

Posted on 2007-08-07
Medium Priority
Last Modified: 2013-11-28
I'd like to export an Access report to rtf as can be done from the file menu in Access when the report is open. I was fiiddling with Docmd.outputto but found no filter criteria which is a problem. My report (when I print) only puts out one filtered record. I'd like the user to put that one record on removable storage and find another printer if need be.
Question by:PiedBird
  • 3
LVL 10

Accepted Solution

OnALearningCurve earned 2000 total points
ID: 19653567
Hi PiedBird,

You could try using "Runcommand"

for example the following two line of code:

DoCmd.OpenReport "Report1", acViewPreview
DoCmd.RunCommand acCmdExport

would open the report called Report1 and then run the export command as though the user had clicked file and export on the menu.

Hope this helps,

LVL 10

Expert Comment

ID: 19653573

Forgot to mention you should be able to edit the OpenReport line to open the report with your required filter.


Author Comment

ID: 19658002
Thanks fella
There's a whole lot revealed with RunCommand I see.
The selectFile dialog that Access uses for the  "export"  pauses my code back in .Net the same as a local .Net dialog box would. I'm most pleased.
LVL 10

Expert Comment

ID: 19658876
Glad I could help!

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question