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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unwanted blank last page when grouping records 1

Status
Not open for further replies.

MikeVE

Programmer
Apr 13, 2002
16
0
0
GB
My report is controlled from VB6. It can be printed with or without grouping. This is controlled by a variable. When the variable is set to turn grouping on, NewPageAfter is set to true in both the last detail section and the group footer. The problem is that when grouping is on, a final page appears with only the page header. I presume that the page I imagined would be the last one is triggering an extra new page. Is there a way of suppressing just this last page?
 
I am not sure how to express this in VB, but with crystal reports, you format the section, and click on the X-2 button to the right of the new page after checkbox to set this conditionally, and enter the statement "Not OnLastRecord".

Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
The final blank page is printing the Report Footer.

If you don't need it, then suppress that section.

Alternatively, use "New Page Before" on the Group Header section and suppress the Report Header section to remove the blank first page.

There are very few things (Charts/Maps and Crosstabs) that should be placed in the Report Header section, so it is a good habit to suppress it anyway. The report header is not the section for page headings. The report footer is often used for Grand Totals, and some of like putting "End of Report" in there. Editor and Publisher of Crystal Clear
 
Thanks for the help. Your answers did not give me the complete solution but they pointed me in the right direction.

First of all I managed to get the desired effect at design time by putting "Not(OnLastRecord)" in the X-2 box for the New Record After property of the Group Header section. This gave the required effect but I wanted my user to be able to turn it on and off. After some more reading in the Crystal Knowledgebase and manual I came up with this.

The NewPageAfter property can be set to true or false at run time but its X-2 formula box can not be accessed. However the formula box can contain a placeholder for a formula field and the formual field CAN be accessed at run time. So -

In the VB Report Designer add a new Formula field called PageBreakAfterGroup but do not put it anywhere on the report. Edit it to contain the word "False". This ensures it will be read as a Boolean type. Go to the format section box and click on Group Header. Click on the X-2 box for the New Page After property and enter "{@PageBreakAfterGroup}" - without the quotes. At run time {@PageBreakAfterGroup} acts as a placeholder for the formula field.

Now for the VB code. On the form which display the CR viewer I had a button for the the viewer to refresh the display and various checkboxes which allow the user to set or clear variables. One of the is glo.blnRptPageBreakOnGroup.

Select Case glo.blnRptPageBreakOnGroup
Case True: Report.FormulaFields(7).Text = "Not OnLastRecord"
Case False: Report.FormulaFields(7).Text = " "
End Select

I got the number of the FormulaField - 7- simply by counting how many formula fields I had in my report design, starting with 1. The PageBreakAfterGroup formual was 7 on the list.

It worked. My users can turn turn pagebreaks on or off without unwanted pages appearing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top