Extra detail format

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

Guest

Hi,

I have a report that list student information and each detail line has
formatting consisting of a horizontal line and other characters that are not
part of the records. Of course when the records run out the detail section
ends. Is there a way to continue the detail section formatting after there
are no more records? I would like the formatting to continue (say 5-10 more
areas or to the end of the page) so that there are places on the report for
the teacher to hand enter new students. I don't think this can be done, but
I thought I would ask. Maybe with a 'do while' loop in the detail footer?

Thanks,
Phil
 
You can create a constant number of lines and "other characters" on each
page with some code in the On Page event. Example to print 24 numbered
rectangles:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.FontSize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub
 
Thanks Duane, I have it working with the following code:
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)
DrawData (sngTop)
Me.DrawWidth = 2
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop
End Sub

[ExtraLines] comes from a text box on the form that calls the report
DataDraw draws a row of formated boxes based on selectons made on the
calling form.
rpt.line draws one extra box that is not part of DataDraw

The problem I have now: based on data in the report the set of boxes at the
bottom of the page may (or may not) be part on the bottom of one page and the
rest on top of the next page. In other words, the top part of the boxes are
on one page and the bottom part on the next page. Do you know of a way to
prevent this. Is there a way to force a page break in the "on page" event or
another soluton?
What I have working is just what I need if I can solve this problem.

Thanks again,
 
I wouldn't know what causes the lines on the second page. I wasn't aware
that code running in one page would cause drawn stuff on other pages.

--
Duane Hookom
MS Access MVP


Phil said:
Thanks Duane, I have it working with the following code:
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)
DrawData (sngTop)
Me.DrawWidth = 2
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop
End Sub

[ExtraLines] comes from a text box on the form that calls the report
DataDraw draws a row of formated boxes based on selectons made on the
calling form.
rpt.line draws one extra box that is not part of DataDraw

The problem I have now: based on data in the report the set of boxes at the
bottom of the page may (or may not) be part on the bottom of one page and the
rest on top of the next page. In other words, the top part of the boxes are
on one page and the bottom part on the next page. Do you know of a way to
prevent this. Is there a way to force a page break in the "on page" event or
another soluton?
What I have working is just what I need if I can solve this problem.

Thanks again,



Duane Hookom said:
You can create a constant number of lines and "other characters" on each
page with some code in the On Page event. Example to print 24 numbered
rectangles:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.FontSize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

--
Duane Hookom
MS Access MVP


are
not 5-10
more report
for done,
but
 
Hi again,

It's working just like any page break (top of form) of a report. If the
report is near the bottom of the page and I print 10 extra sets of boxes
using the On Form event of the detail footer and there is only room for 4 1/2
boxes at the bottom of the page, the 4 1/2 boxes print at the bottom of the
page and the other 5 1/2 print on the top of the next page and the report
continues on with the next detail section.
Do you know of any way to tell if the report is near the end of a page so I
could force a page break (if that's possible) in my Do While Loop before the
half box prints?

Thanks,
Phil
Duane Hookom said:
I wouldn't know what causes the lines on the second page. I wasn't aware
that code running in one page would cause drawn stuff on other pages.

--
Duane Hookom
MS Access MVP


Phil said:
Thanks Duane, I have it working with the following code:
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)
DrawData (sngTop)
Me.DrawWidth = 2
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop
End Sub

[ExtraLines] comes from a text box on the form that calls the report
DataDraw draws a row of formated boxes based on selectons made on the
calling form.
rpt.line draws one extra box that is not part of DataDraw

The problem I have now: based on data in the report the set of boxes at the
bottom of the page may (or may not) be part on the bottom of one page and the
rest on top of the next page. In other words, the top part of the boxes are
on one page and the bottom part on the next page. Do you know of a way to
prevent this. Is there a way to force a page break in the "on page" event or
another soluton?
What I have working is just what I need if I can solve this problem.

Thanks again,



Duane Hookom said:
You can create a constant number of lines and "other characters" on each
page with some code in the On Page event. Example to print 24 numbered
rectangles:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.FontSize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

--
Duane Hookom
MS Access MVP


Hi,

I have a report that list student information and each detail line has
formatting consisting of a horizontal line and other characters that are
not
part of the records. Of course when the records run out the detail
section
ends. Is there a way to continue the detail section formatting after
there
are no more records? I would like the formatting to continue (say 5-10
more
areas or to the end of the page) so that there are places on the report
for
the teacher to hand enter new students. I don't think this can be done,
but
I thought I would ask. Maybe with a 'do while' loop in the detail footer?

Thanks,
Phil
 
I don't know how to determine where you are on the page. When I use code to
draw boxes, I use the On Page to draw a constant number of boxes.

--
Duane Hookom
MS Access MVP
--

Phil said:
Hi again,

It's working just like any page break (top of form) of a report. If the
report is near the bottom of the page and I print 10 extra sets of boxes
using the On Form event of the detail footer and there is only room for 4
1/2
boxes at the bottom of the page, the 4 1/2 boxes print at the bottom of
the
page and the other 5 1/2 print on the top of the next page and the report
continues on with the next detail section.
Do you know of any way to tell if the report is near the end of a page so
I
could force a page break (if that's possible) in my Do While Loop before
the
half box prints?

Thanks,
Phil
Duane Hookom said:
I wouldn't know what causes the lines on the second page. I wasn't aware
that code running in one page would cause drawn stuff on other pages.

--
Duane Hookom
MS Access MVP


Phil said:
Thanks Duane, I have it working with the following code:
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)
DrawData (sngTop)
Me.DrawWidth = 2
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop
End Sub

[ExtraLines] comes from a text box on the form that calls the report
DataDraw draws a row of formated boxes based on selectons made on the
calling form.
rpt.line draws one extra box that is not part of DataDraw

The problem I have now: based on data in the report the set of boxes
at the
bottom of the page may (or may not) be part on the bottom of one page
and the
rest on top of the next page. In other words, the top part of the
boxes are
on one page and the bottom part on the next page. Do you know of a
way to
prevent this. Is there a way to force a page break in the "on page"
event or
another soluton?
What I have working is just what I need if I can solve this problem.

Thanks again,



:

You can create a constant number of lines and "other characters" on
each
page with some code in the On Page event. Example to print 24
numbered
rectangles:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.FontSize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

--
Duane Hookom
MS Access MVP


Hi,

I have a report that list student information and each detail line
has
formatting consisting of a horizontal line and other characters
that are
not
part of the records. Of course when the records run out the
detail
section
ends. Is there a way to continue the detail section formatting
after
there
are no more records? I would like the formatting to continue (say 5-10
more
areas or to the end of the page) so that there are places on the report
for
the teacher to hand enter new students. I don't think this can be done,
but
I thought I would ask. Maybe with a 'do while' loop in the detail footer?

Thanks,
Phil
 
I have many reports that list students by teacher, by class, by grade, etc.
Each report has detail footers that depend on the grouping. I want to give
the user to option to print any number of extra lines to add additional
students in each group. So depending on the report my "extra" lines at the
end of each group can be anywhere on the page depending on what else is
printed on the page. I been saying that 1/2 of the box prints on one page
and the second half prints on the next page, well it can be any part of a box
(1/2, 1/3, 1/4 or any other part of a box), it just depends where the data on
the page ends. Maybe there is no solution for this problem and I'll just
have to live with the partial boxes.
Even if I draw a constant number of boxes the same thing will happen if the
group footer is at the end of the page...
Is there a variable that tells one how far down they are on a page? I think
from your last response you said no, but I'm not sure. If there is and if
there is a command for a Page Break I think I could solve my problem.

Thanks again


Duane Hookom said:
I don't know how to determine where you are on the page. When I use code to
draw boxes, I use the On Page to draw a constant number of boxes.

--
Duane Hookom
MS Access MVP
--

Phil said:
Hi again,

It's working just like any page break (top of form) of a report. If the
report is near the bottom of the page and I print 10 extra sets of boxes
using the On Form event of the detail footer and there is only room for 4
1/2
boxes at the bottom of the page, the 4 1/2 boxes print at the bottom of
the
page and the other 5 1/2 print on the top of the next page and the report
continues on with the next detail section.
Do you know of any way to tell if the report is near the end of a page so
I
could force a page break (if that's possible) in my Do While Loop before
the
half box prints?

Thanks,
Phil
Duane Hookom said:
I wouldn't know what causes the lines on the second page. I wasn't aware
that code running in one page would cause drawn stuff on other pages.

--
Duane Hookom
MS Access MVP


Thanks Duane, I have it working with the following code:
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)
DrawData (sngTop)
Me.DrawWidth = 2
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop
End Sub

[ExtraLines] comes from a text box on the form that calls the report
DataDraw draws a row of formated boxes based on selectons made on the
calling form.
rpt.line draws one extra box that is not part of DataDraw

The problem I have now: based on data in the report the set of boxes
at
the
bottom of the page may (or may not) be part on the bottom of one page
and
the
rest on top of the next page. In other words, the top part of the
boxes
are
on one page and the bottom part on the next page. Do you know of a
way
to
prevent this. Is there a way to force a page break in the "on page"
event
or
another soluton?
What I have working is just what I need if I can solve this problem.

Thanks again,



:

You can create a constant number of lines and "other characters" on
each
page with some code in the On Page event. Example to print 24
numbered
rectangles:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.FontSize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

--
Duane Hookom
MS Access MVP


Hi,

I have a report that list student information and each detail line
has
formatting consisting of a horizontal line and other characters
that
are
not
part of the records. Of course when the records run out the
detail
section
ends. Is there a way to continue the detail section formatting
after
there
are no more records? I would like the formatting to continue (say
5-10
more
areas or to the end of the page) so that there are places on the
report
for
the teacher to hand enter new students. I don't think this can be
done,
but
I thought I would ask. Maybe with a 'do while' loop in the detail
footer?

Thanks,
Phil
 
I know of no property or variable that suggests how far down a page you are.
Stephen Lebans may have something on his site www.lebans.com.

Another option may be to create a union query based on your original query
and a table with a single numeric field with values 1 through a large
number. You can then limit the Record Source query to records where the
numeric field <= any other number. This would create blank records in your
report.

--
Duane Hookom
MS Access MVP


Phil said:
I have many reports that list students by teacher, by class, by grade, etc.
Each report has detail footers that depend on the grouping. I want to give
the user to option to print any number of extra lines to add additional
students in each group. So depending on the report my "extra" lines at the
end of each group can be anywhere on the page depending on what else is
printed on the page. I been saying that 1/2 of the box prints on one page
and the second half prints on the next page, well it can be any part of a box
(1/2, 1/3, 1/4 or any other part of a box), it just depends where the data on
the page ends. Maybe there is no solution for this problem and I'll just
have to live with the partial boxes.
Even if I draw a constant number of boxes the same thing will happen if the
group footer is at the end of the page...
Is there a variable that tells one how far down they are on a page? I think
from your last response you said no, but I'm not sure. If there is and if
there is a command for a Page Break I think I could solve my problem.

Thanks again


Duane Hookom said:
I don't know how to determine where you are on the page. When I use code to
draw boxes, I use the On Page to draw a constant number of boxes.

--
Duane Hookom
MS Access MVP
--

Phil said:
Hi again,

It's working just like any page break (top of form) of a report. If the
report is near the bottom of the page and I print 10 extra sets of boxes
using the On Form event of the detail footer and there is only room for 4
1/2
boxes at the bottom of the page, the 4 1/2 boxes print at the bottom of
the
page and the other 5 1/2 print on the top of the next page and the report
continues on with the next detail section.
Do you know of any way to tell if the report is near the end of a page so
I
could force a page break (if that's possible) in my Do While Loop before
the
half box prints?

Thanks,
Phil
:

I wouldn't know what causes the lines on the second page. I wasn't aware
that code running in one page would cause drawn stuff on other pages.

--
Duane Hookom
MS Access MVP


Thanks Duane, I have it working with the following code:
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)
DrawData (sngTop)
Me.DrawWidth = 2
rpt.Line (23, sngTop)-(460, sngTop + 70), lngColor, B
intx = intx + 1
Loop
End Sub

[ExtraLines] comes from a text box on the form that calls the report
DataDraw draws a row of formated boxes based on selectons made on the
calling form.
rpt.line draws one extra box that is not part of DataDraw

The problem I have now: based on data in the report the set of boxes
at
the
bottom of the page may (or may not) be part on the bottom of one page
and
the
rest on top of the next page. In other words, the top part of the
boxes
are
on one page and the bottom part on the next page. Do you know of a
way
to
prevent this. Is there a way to force a page break in the "on page"
event
or
another soluton?
What I have working is just what I need if I can solve this problem.

Thanks again,



:

You can create a constant number of lines and "other characters" on
each
page with some code in the On Page event. Example to print 24
numbered
rectangles:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.FontSize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

--
Duane Hookom
MS Access MVP


Hi,

I have a report that list student information and each detail line
has
formatting consisting of a horizontal line and other characters
that
are
not
part of the records. Of course when the records run out the
detail
section
ends. Is there a way to continue the detail section formatting
after
there
are no more records? I would like the formatting to continue (say
5-10
more
areas or to the end of the page) so that there are places on the
report
for
the teacher to hand enter new students. I don't think this can be
done,
but
I thought I would ask. Maybe with a 'do while' loop in the detail
footer?

Thanks,
Phil
 
Phil said:
I have many reports that list students by teacher, by class, by grade, etc.
Each report has detail footers that depend on the grouping. I want to give
the user to option to print any number of extra lines to add additional
students in each group. So depending on the report my "extra" lines at the
end of each group can be anywhere on the page depending on what else is
printed on the page. I been saying that 1/2 of the box prints on one page
and the second half prints on the next page, well it can be any part of a box
(1/2, 1/3, 1/4 or any other part of a box), it just depends where the data on
the page ends. Maybe there is no solution for this problem and I'll just
have to live with the partial boxes.
Even if I draw a constant number of boxes the same thing will happen if the
group footer is at the end of the page...
Is there a variable that tells one how far down they are on a page? I think
from your last response you said no, but I'm not sure. If there is and if
there is a command for a Page Break I think I could solve my problem.


Set the detail section's KeepTogether property to prevent a
detail from being split across a page boundary.

You can tell where the detail section is relative to the top
of the page by using Me.Top

You can set the control values to Null so that they display
with nothing in them.

Using a detail counter text box (=1, RunningSum Over Group)
and a group header text box with =Count(*), you can
determine when you are on the last detail in the group.

You can then use the report's NextRecord method to cause the
detail section to be displayed multiple times.

Combining all that with some code allows you to display
"blank" records from the last detail to the bottom of the
page.

Here's some untested air code with the general idea:

Sub Detail_Format(...
Static intExtra As Integer
If Me.DetailCnt = Me.GroupCnt Then
If intExtra = 1 Then
Me.textbox1 = Null ' first blank record
Me.textbox2 = Null
. . .
intExtra = 2
Me.NextRecord = False
End If
If intExtra > 0 Then
If Me.Top < 9 * 1440 Then ' near bottom yet?
Me.NextRecord = False
Else ' page is full, all done
intExtra =0
End If
Else ' process last real detail
intExtra = 1
Me.NextRecord = False
End If
Else
' normal detail

End If

Set the 9 in 9 * 1440 to the number of inches from the top
of the page where there is room for just one more "blank"
detail.
 
Back
Top