vertical lines

  • Thread starter Thread starter Paulo
  • Start date Start date
P

Paulo

I have a report which consists of:
Report header
Page header
Detail
Page footer

Is there a way to generate vertical lines which would run
from either the top to bottom of the page?

Right now the report has several inches of blank space in
the middle of it, because the detail does not repeat
enough times to get down to page footer section.

Also, the number of times the detail will repeat varies
from report to report.
 
Paulo said:
I have a report which consists of:
Report header
Page header
Detail
Page footer

Is there a way to generate vertical lines which would run
from either the top to bottom of the page?

Right now the report has several inches of blank space in
the middle of it, because the detail does not repeat
enough times to get down to page footer section.

Also, the number of times the detail will repeat varies
from report to report.


You have to use the report's Page event to draw lines
outside of the individual sections. The code could look
like:

Const TWIPS As Long = 1440
Const TOPMARGIN As Long = 0.6 * TWIPS
Const BOTTOMMARGIN As Long = 0.8 * TWIPS
Const PAGEHEIGHT As Long = 11 * TWIPS

Private Sub Report_Page()
Me.Line (Me.control1.Left, Me.Section(3).Height) _
-(Me.control1.Left, PAGEHEIGHT - TOPMARGIN _
- BOTTOMMARGIN - Me.Section(4).Height)
Me.Line (Me.control2.Left, Me.Section(3).Height) _
-(Me.control2.Left, PAGEHEIGHT - TOPMARGIN _
- BOTTOMMARGIN - Me.Section(4).Height)
. . .
End Sub
 
Dear Paulo:

I have the same problem

I solve in part
(i think is not the right solution but works)
(only if you do not move the top and bottom margins)

First add a group footer
then add vertical lines aligned to the detail lines
with height zero (0)

'add a counter for each detail record in every page
Private Sub PageHeader_Format(Cancel As Integer,
FormatCount As Integer)
'Resets subtotal page to zero
how_records = 0
End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
'Count number of records and stores subtotal for eachpage
how_records = how_records + 1
End Sub

In group_footer_format sub do this

'for each line this is a example
dim x as double (line height in detail group)
dim y as integer (max detail records in a page) (whith no
blank spaces)

x = line01.height 'supose is a line in detail group
y = 8 'suppose the max quantity of detail records in your
page

'line in group footer to grow
line02.height = x * 8 - howrecords
'in this case the height of the vertical line is the
'height of 8 lines in detail records
'minus the quantiy of detailed records printed already
 
Jaime said:
I have the same problem

I solve in part
(i think is not the right solution but works)
(only if you do not move the top and bottom margins)

First add a group footer
then add vertical lines aligned to the detail lines
with height zero (0)

'add a counter for each detail record in every page
Private Sub PageHeader_Format(Cancel As Integer,
FormatCount As Integer)
'Resets subtotal page to zero
how_records = 0
End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
'Count number of records and stores subtotal for eachpage
how_records = how_records + 1
End Sub

In group_footer_format sub do this

'for each line this is a example
dim x as double (line height in detail group)
dim y as integer (max detail records in a page) (whith no
blank spaces)

x = line01.height 'supose is a line in detail group
y = 8 'suppose the max quantity of detail records in your
page

'line in group footer to grow
line02.height = x * 8 - howrecords
'in this case the height of the vertical line is the
'height of 8 lines in detail records
'minus the quantiy of detailed records printed already


Jaime, you can't rely on using event procedures to count
records on a page. The data in a report is not guaranteed
to be processed sequentially. There are many situations
where Access may skip the print event for one or more
records (e.g. skiping around the pages in preview). There
are many more cases where the Format and Print events will
fire more than once for some records.

It is far easier to use the Line method in the Page event.
If you need to know where on the page the last record is,
set a module level variable in each detail event.

lngLastPosition = Me.Top + Me.Section(0).Height
 
Thanks Marshall:

Im using you code now and it works fine, but when i change
topmargin in Page Setup the lines go down to the page
footer section.

I don't want to care about top margin and im looking for
a reports property to get the current page top margin on
each ms access computer instalation.
 
by the way, i want to give some format to the new lines like border with 1pt. not hairline like default.
 
Jaime said:
Im using you code now and it works fine, but when i change
topmargin in Page Setup the lines go down to the page
footer section.

I don't want to care about top margin and im looking for
a reports property to get the current page top margin on
each ms access computer instalation.


You can use the PrtMips Property to extract the margin
sizes. If you're using A2002 or later, it's also available
in the easier to use the Printer object (see Help).

If you don't want to get into all these grungy details, you
can use Stephen Lebans' PrintLines at www.lebans.com, which
takes care of all this gobbledy gook for you. If you really
want to understand this stuff, study Stephen's code and
example reports. It's all there.
 
Jaime said:
by the way, i want to give some format to the new lines like border with 1pt. not hairline like default.


Check the properties list of the Report object in Help
(DrawWidth, DrawStyle, etc.)
 
Back
Top