Detail footer 'On Print'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have various reports that print student lists grouped on various options;
by teacher, by grade, by class..... The line in detail section lists the
students name and rows of boxes based on the report fields. The boxes are
printed using the rpt.Line function.
I want the report to have the option to print additional lines of boxes
beyond the last student of each section. This would allow the teacher to
have spaces to write in additional students to each group. I have the
following code in the "on print" event of the detail footer.

Set rpt = Reports![by teacher / grade]
intx = 0
Do While (intx <> [Forms]![Report Menu]![ExtraLines])
sngTop = rpt.ScaleTop + (70 * intx)
DrawData (sngTop)
Me.DrawWidth = 2

rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop

[Forms]![Report Menu]![ExtraLines]) is a text box on the form that calls the
report and is the number of extra lines desired.
rpt.Line draws the box around the area where the student name would be in
the regular detail section

Here's my problem. If the additional boxes go beyond the allowable room on
the current page the row of boxes are split, part on this page and part on
the next page. When I say split I mean the top part of the each box in the
row is on the first page and the bottom part is on the next page. For
example: if I want 10 extra rows the first page might have 4 1/2 boxes and
the next page would have 5 1/2 boxes. The boxes are not split on whole
boxes, but on partial boxes.

I've worked with Duane in the Report group and resolved all my other
problems, but this one I'm stuck on. Is there any way to know where you are
in printing a page and if you're close to the end to force a page break? If
there is I could place the code in my footer on-page event.
Thanks
 
Phil wrote:
[snip]
Is there any way to know where you are
in printing a page and if you're close to the
end to force a page break?

Didn't I answer that in the report's thread?

In case you missed it, you can use Me.Top to get the detail
section's beginning position on the page.

For each box, you need to specify the values of CurrentY, so
you already know where you are within the detail section.
 
Thanks Marsh, That's just what I needed. But now is there a command that I
can place in my do-while loop to force a page break when I reach my limit?
I've been looking but can't find one.

Thanks

Marshall Barton said:
Phil wrote:
[snip]
Is there any way to know where you are
in printing a page and if you're close to the
end to force a page break?

Didn't I answer that in the report's thread?

In case you missed it, you can use Me.Top to get the detail
section's beginning position on the page.

For each box, you need to specify the values of CurrentY, so
you already know where you are within the detail section.
 
Phil said:
Thanks Marsh, That's just what I needed. But now is there a command that I
can place in my do-while loop to force a page break when I reach my limit?
I've been looking but can't find one.

You can use the Page Break control in the tool box. Just
make it visible or invisible as needed.
 
Thanks again Marsh, but I don't get it. Do I drag the page break into the
footer area? I tried this and it's there but then how do I set it to visible
or not? Everything I tried didn't work.

Thanks
 
Phil said:
Thanks again Marsh, but I don't get it. Do I drag the page break into the
footer area? I tried this and it's there but then how do I set it to visible
or not? Everything I tried didn't work.


Without knowing more about what you're trying to do, your
report's design and what you've tried, I can't be very
helpful. As far as making a control visible or not, just
set it's visible property as needed.

If <somecondition> Then
Me.pagebreak.Visible = True
Else
Me.pagebreak.Visible = False
End If
 
Hi again

I tried to add the Page break to the footer, but then it just does a page
break based on the location of the Page break in the footer section. I tried
to set PageBreak.Top thinking this might be a solution, but it would not
allow me to set it. I tried placing the page break in various locations in
the footer section and making it visible or not and that didn't work.

I'm trying to allow the user to select the number of extra lines of boxes to
be printed below each detail section. After the last student prints for a
given group I want to print more row of formated boxes so the teacher has an
area to hand write in additonal students. Here is the code in my footer:

Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
Dim sngTop As Long
Dim rpt As Report
Dim intx As Integer
Set rpt = Reports![by teacher / grade]
intx = 0
Do While (intx <> [Forms]![Report Menu]![ExtraLines])
sngTop = rpt.ScaleTop + (70 * intx)
' Draws a row of boxes
DrawData (sngTop)
Me.DrawWidth = 2
' draws a box for the student name before the row of boxes
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B

This is where I would like to have a page break if Me.Top and CurrentY
exceeds a given value (say 14,000). I want a page break and then continue in
the do-while loop.

intx = intx + 1
Loop
End Sub

Right now when the botton of the page is reahed a single row of boxes would
be split with the top part of the boxes at the bottom of one page and the
bottom part of the row of boxes on the next page.

Additonal help would be appreciated. I'm close but still have the splitting
box issue.

Thanks,
 
Phil said:
I tried to add the Page break to the footer, but then it just does a page
break based on the location of the Page break in the footer section. I tried
to set PageBreak.Top thinking this might be a solution, but it would not
allow me to set it. I tried placing the page break in various locations in
the footer section and making it visible or not and that didn't work.

I'm trying to allow the user to select the number of extra lines of boxes to
be printed below each detail section. After the last student prints for a
given group I want to print more row of formated boxes so the teacher has an
area to hand write in additonal students. Here is the code in my footer:

Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
Dim sngTop As Long
Dim rpt As Report
Dim intx As Integer
Set rpt = Reports![by teacher / grade]
intx = 0
Do While (intx <> [Forms]![Report Menu]![ExtraLines])
sngTop = rpt.ScaleTop + (70 * intx)
' Draws a row of boxes
DrawData (sngTop)
Me.DrawWidth = 2
' draws a box for the student name before the row of boxes
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B

This is where I would like to have a page break if Me.Top and CurrentY
exceeds a given value (say 14,000). I want a page break and then continue in
the do-while loop.

intx = intx + 1
Loop
End Sub

Right now when the botton of the page is reahed a single row of boxes would
be split with the top part of the boxes at the bottom of one page and the
bottom part of the row of boxes on the next page.


That gives me a much clearer understanding of what you're
talking about, but I think you're problems all stem from
trying to do all the boxes in your own loop. Let me suggest
a different approach.

Remove all the code and just use Label or Text Box controls
with BorderStyle set to solid for only one of your "blank"
lines. If you do nothing else, you should see what you
want, but only one line's worth of boxes.

To get more lines, use the report's NextRecord property.
This requires that you make intX a module level variable
that's initialized in the group header section's Format
event.

The group footer's Format event would then only need a few
lines of code. The module's code would be like this:

Dim intX As Integer

Private Sub GroupFooter1_Format(Cancel As Integer,
FormatCount As Integer)
intX = intX - 1
Me.NextRecord = (intX < 1)
Me.pgBreak.Visible = (Me.Top > 8.7 * 1440)
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
intX = 3
End Sub

Don't forget to set the section's KeepTogether property to
Yes.
 
Back
Top