Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Report to PDF _ File name by Group?

Status
Not open for further replies.

misscrf

Technical User
Jun 7, 2004
1,344
US
I have a report which is grouped in header and footer. Each report has the page break set on the group footer. Any way I can write code or a macro or something that will print my report to a directory, printing each group to its own report, naming such report as it's header with the report name as a pre-fix?

Thanks!

i.e.

Report1

GroupA
detail
GroupB
detail
GroupC
detail

= Output folder:
Report1GroupA.pdf
Report1GroupB.pdf
Report1GroupC.pdf


misscrf

It is never too late to become what you could have been ~ George Eliot
 
I think the easiest way to do this is write some sql code ,use loop, and use Leban's ConvertReportToPDF module

on a form have a text box txtGroupID, modify your reports datasource criterion for the group( where groupid = forms!form1!txtGroupID)

write some code:
set rst=currentdb("SELECT distinct GroupID from reportdatasource",dbopensnapshot)
rst.movelast
CTR=rst.recordcounter
rst.movefirst
for X=1 to CTR
blRet = ConvertReportToPDF(ReportName, vbNullString, _
"C:/" & ReportName & rst!groupid & ".pdf", False, False, 150, "", "", 0, 0, 0)
rst.movenext
next X

I hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top