Set report breaks with VBA

Joined
May 16, 2006
Messages
3
Reaction score
0
I have a report that I would like to print in two ways. It is a report that gives measurements by employee. One version of the report should list each employee with their results one right after the other. The other version of the report should break after each employee so that each employee has his own separate page of the report. The simplest thing to do would be to just create two versions of the report, but I wanted to try setting the break group option ForceNewPage via VB code. Can anyone tell me how to do this? when I use the following code:

Reports![rptAvgTOTime].Section(acDetail).ForceNewPage

I get the message that the report name is misspelled or the report is not open.

Thanks!
-KRT
 
Okay, I see that I had a syntax error. I should have typed:

application.reports("rptAVGTOTime").section("GroupHeader0").ForceNewPage=1

Also, I needed to open the report first so that Access can "see" it. I used the code:

DoCmd.OpenReport "rptAvgTOTime", acViewDesign
Application.Reports("rptAvgTOTime").Visible = False
 
Back
Top