I am using Access 97. I created 1 large report that gives an agency's name as the form/report page header and a list of Names, SubAgency, and Email on the body/detail of the page.
I want to break up the large report into smaller reports based on each agency and I want create a file for each report.
I generated the following code but that was suggested by someone else but I cannot get it to work. I have very little VB experience. Any suggestions on how to procede?
Option Compare Database
Sub Separate()
Dim rpt As Report
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Table1", dbOpenForwardOnly)
Do
DoCmd.OpenReport "Report1", acViewDesign
Set rpt = Reports("Report1")
rpt.Filter = "Agency=" & rs![Agency]
rpt.FilterOn = True
DoCmd.OutputTo acReportOutput, "Report1", "HTML(*.html)", "C:\FDLEfiles\&rs![Agency].html", False
DoCmd.Close acReport, "1229-9", acSaveNo
rs.MoveNext
Loop Until rs.EOF
End Sub
Any Suggestion? Thanks!
I want to break up the large report into smaller reports based on each agency and I want create a file for each report.
I generated the following code but that was suggested by someone else but I cannot get it to work. I have very little VB experience. Any suggestions on how to procede?
Option Compare Database
Sub Separate()
Dim rpt As Report
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Table1", dbOpenForwardOnly)
Do
DoCmd.OpenReport "Report1", acViewDesign
Set rpt = Reports("Report1")
rpt.Filter = "Agency=" & rs![Agency]
rpt.FilterOn = True
DoCmd.OutputTo acReportOutput, "Report1", "HTML(*.html)", "C:\FDLEfiles\&rs![Agency].html", False
DoCmd.Close acReport, "1229-9", acSaveNo
rs.MoveNext
Loop Until rs.EOF
End Sub
Any Suggestion? Thanks!