Access report: export to file (using filter criteria)

Posted on 2007-08-07
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
    LVL 10

    Accepted Solution

    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


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


    Author Comment

    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

    Glad I could help!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now