OutputTo: Specify Report Criteria

W

Warren

Hi,

I am having trouble trying to specify the the criteria for
my report in VBA, and then using automation to output the
report to RTF.

I can generate a Preview document of the report using:
-Method1

strLinkCriteria = "[Field1] = 'Value1'"
DoCmd.OpenReport( strReportName, acViewPreview, ,
strLinkCriteria)
but then I have to manually export the file.


I can use automation to Print the report right to the file
in this format:
-Method2

DoCmd.OutputTo acOutputReport, strReportName, acFormatRTF,
strFileName
but I can't seem to find a way to pass in the
strLinkCritera in the .OutputTo procedure.

I have tried using the Lebans utility, but I do not want
to use the snapshot route, as I want the file to be easily
editable after exporting to RTF.

Any advice is greatly appreciated.
Thanks
Warren
 
J

Jim/Chris

Have you tried basing the report on a Query which contains
the criteria. this criteria could be based on controls in
an open form.

Jim
 
W

Warren Novis

Thanks for the reply.
I have tried your suggestion, but I am running into issues
in the implementation.

I am trying to dynamically assign the report
Recordsource to a query on the fly.

Here's a snipit of the proc.
Please let me know if you have any comments.
Thanks
Warren
-------------------------------
Dim qry as QueryDef, rpt as Report
Set qry = New QueryDef
qry.Name = "qry_Report" '(this is the name of the query
that is that the report is linked to)
qry.SQL = "Select....blah.....Where " & strLinkCriteria

Set rpt = New Report
rpt.Name = strReport (the name of the report I want to
print)
rpt.RecordSource = qry.SQL

DoCmd.OutputTo acOutputReport,rpt.Name,acFormatRTF,
strFileName, True
---------------------------

-----Original Message-----
Have you tried basing the report on a Query which contains
the criteria. this criteria could be based on controls in
an open form.

Jim
-----Original Message-----
Hi,

I am having trouble trying to specify the the criteria for
my report in VBA, and then using automation to output the
report to RTF.

I can generate a Preview document of the report using:
-Method1

strLinkCriteria = "[Field1] = 'Value1'"
DoCmd.OpenReport( strReportName, acViewPreview, ,
strLinkCriteria)
but then I have to manually export the file.


I can use automation to Print the report right to the file
in this format:
-Method2

DoCmd.OutputTo acOutputReport, strReportName, acFormatRTF,
strFileName
but I can't seem to find a way to pass in the
strLinkCritera in the .OutputTo procedure.

I have tried using the Lebans utility, but I do not want
to use the snapshot route, as I want the file to be easily
editable after exporting to RTF.

Any advice is greatly appreciated.
Thanks
Warren
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top