Lines in a report containing a sub report

J

jeanulrich00

Hi

The question is not simple so I will try to be the most precise I can
be

I have a report with no record source

In the detail section i draw many horizontal lines (18) and I have
approximative 1.5" header and around 2" footer.

No problem to print, everythig is fine.

There is one vertical line that separate the report in 2 sections Left
and Right

I am trying to add a subreport (continuous and based on a query) into
the Right section.

Let say the subreport contains 50 records. The subreport height is the
same as the detail section of the report

Distance between lines on the report is the same as the fields height
of the subreport.

When I want to print, I see that page 1 is perfect, but when i go to
pages 2 and others, lines at the left disapears.

How can I manage to avoid this problem. I wat to see the 18
horizontal lines even if there is only 2 records in the subreport and
the same if there is 100 records. I all the time want to see
horizontal lines of the left section

I Hope my question is clear and thanks a lot for helping
 
K

Ken Sheridan

You will need to draw the lines at runtime, using the Line method of the
report object by putting code in the report's page event procedure. The
following will draw a vertical line at the midpoint of the page, from the
bottom of the page header to the top of the page footer, and 18 equally
spaced horizontally lines 300 twips to the left of the midpoint ( a twip is
the unit of length used by VBA , being one twentieth of a point, a point
being a typography unit of one seventy second of an inch, so there are 1440
twips per inch. 300 twips is roughly 5mm therefore). The top and bottom
lines will be the same distance below and above the header/footer as the
spacing between the lines:

Private Sub Report_Page()

Dim n As Integer
Dim intTop As Integer, intBottom As Integer
Dim dblSpacing As Double

intTop = Me.Section(acPageHeader).Height
intBottom = Me.Section(acPageFooter).Height

' set line width to one quarter point
Me.DrawWidth = 5

'Draw vertical line from bottom of header to top of footer
Me.Line (Me.ScaleWidth / 2, intTop) _
-(Me.ScaleWidth / 2, (Me.ScaleHeight - intBottom))

' compute line spacing
dblSpacing = ((Me.ScaleHeight - (intTop + intBottom)) / 19)

' Draw 18 horizontal lines
For n = 1 To 18
Me.Line (0, (intTop + dblSpacing * n)) _
-((Me.ScaleWidth / 2) - 300, (intTop + (dblSpacing) * n))
Next n

End Sub

You can use a subreport, but you don't actually need one. You can use a
bound main report, putting all the bound controls in the detail section to
the right of the page centre. Because the lines are drawn in relation to the
page, not the detail section the latter can grow or shrink at will without
affecting the line positioning.

Ken Sheridan
Stafford, England
 

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