filters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi -

If someone can help me with this, I would really appreciate it. What I want
to do is use excel to open an instance of access and export a report to my c
drive that has filters. My original code simply opens the report and prints
it out e.g.

OpenCurrentDatabase ("urizen.mdb")
DoCmd.OpenReport "Rpt1", acViewNormal, "Floor='10'"

but now i would like to just export it without printing it out, which i can
do with the following line of code:

DoCmd.OutputTo acOutputReport, "Rpt1", acFormatRTF, "c:\temp\Rpt1.rtf"

is there any way i can specify the filter using the OutputTo method?

Thanks.
 
One alternative is to open the report using the OpenReport method supplying
the filter, and then calling the OutputTo method on the open report. If you
use the acViewPreview parameter in the OpenReport method, the report is not
printed. For example:

DoCmd.OpenReport "Rpt1", acViewPreview, "Floor='10'"
DoCmd.OutputTo acOutputReport, "", acFormatRTF, "c:\temp\Rpt1.rtf"
DoCmd.Close acReport, "Rpt1", acSaveNo

By not specifying the report name in the OutputTo method, the active report
is used.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hi -

If someone can help me with this, I would really appreciate it. What I want
to do is use excel to open an instance of access and export a report to my c
drive that has filters. My original code simply opens the report and prints
it out e.g.

OpenCurrentDatabase ("urizen.mdb")
DoCmd.OpenReport "Rpt1", acViewNormal, "Floor='10'"

but now i would like to just export it without printing it out, which i can
do with the following line of code:

DoCmd.OutputTo acOutputReport, "Rpt1", acFormatRTF, "c:\temp\Rpt1.rtf"

is there any way i can specify the filter using the OutputTo method?

Thanks.
 
Back
Top