Force New Page - Report Totals

J

Josetta

Here is something really bizarre that is happening...let me see if I
can describe it.

I have a report which has two locations on it. Primary Location and
Secondary Location. I have both locations grouped. For example:


Primary Location (group header 1) is a city.
Secondary Location (group header 2) is a Street Address.


Avon
Ronald Reagan Parkway
Greenwood
County Line Road
Indianapolis
Senate Boulevard
Kessler Bouldevard
Clearvista Drive


I have invisible text boxes in both headers, which I have set to =1
and a running sum over all.
I have invisible footers which reference the name of the text box
with
the running sum.
All is working very well with that.


In the report footer, I have a text box that says:
="Total Primary Locations: " & [Text46] (which references the text
box
in the footer)
I also have one like this for the secondary location.


So my text box should read:


Total Primary Locations: 3
Total Secondary Locations: 5


Here's what actually happens:


If I use Force New Page on the Report Footer, the totals are correct.


If I don't, the totals say


Total Primary Locations: 1
Total Secondary Locations: 1


But I really want both totals to fit on the first page if they can,
without having to force a new page.


Has anyone encountered this before? It seems to be a bug having to
do
with the format count. Is there a workaround for this?
 
K

Ken Sheridan

I can see no reason why you need the hidden text box controls in the group
footers. Why not simply reference those in the group headers in the
ControlSource properties of the two text box controls in the report footer?

Another approach would be to increment the values of text box controls in
the report footer in code. In the Print event procedure of the report header
initialize them to zero:

Me.txtTotalPrimaryLocations = 0
Me.txtTotalSecondaryLocations = 0

In the print event procedures of each group header increment the relevant
control, examining the PrintCount property to avoid inadvertent double
counting. In header 1:

If PrintCount = 1 Then
Me.txtTotalPrimaryLocations = Me.txtTotalPrimaryLocations + 1
End If

and in header 2:

If PrintCount = 1 Then
Me.txtTotalSecondaryLocations = Me.txtTotalSecondaryLocations + 1
End If

In the report footer's Print event procedure add the text:

If PrintCount = 1 Then
Me.txtTotalPrimaryLocations = _
"Total Primary Locations: " & _
Me.txtTotalPrimaryLocations
Me.txtTotalSecondaryLocations = _
"Total Secondary Locations: " & _
Me.txtTotalSecondaryLocations
End If

Ken Sheridan
Stafford, England
 
J

Josetta

Referencing the text boxes didn't work. It kept asking for a
"parameter". I tried to do the incrementing in the format and that
didn't work either, but I will try to use the print count property
today and let you know how that works. Thanks for the suggestion.

Josetta
 

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