Report Lines

EllieFant

New member
Local time
Yesterday, 23:42
Joined
Jun 8, 2002
Messages
5
My boss wants to make a report look more like a form by putting a border around sections in the report. I have done so using the following code:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim X3 As Single, Y3 As Single
Dim X4 As Single, Y4 As Single
Dim Color As Long

' Specify unit of measurement for coordinates on a page...
Me.ScaleMode = 5 ' Specify that measurement occur in inches.

' Set line to print 5 inches from the left margin.
'X1 = 5
X1 = 0
X2 = 0
X3 = 6.5
X4 = 6.5

' Set line to print from the top of the detail section
' to a maximum height of 22 inches.
Y1 = 0
Y2 = 22
Y3 = 0
Y4 = 22

Me.DrawWidth = 30 ' Width of the line (in pixels).
Color = RGB(0, 0, 0) ' Use black line color.

' Draw the line with the Line method.
Me.Line (X1, Y1)-(X2, Y2), Color
Me.Line (X3, Y3)-(X4, Y4), Color
End Sub


HOWEVER, if the detail section goes over to a second page, there is no bottom line on the first page. Right now the bottom line is drawn in so it appears at the bottom of the section (whatever page the section ends on).

How do I get it on the bottom of the page if the detail section flows over.

Thanks!
Lena
 
What I would do is draw a line in the section footer. Any time the section ends on the report - no matter how many pages the report is - we know there will be a "bottom line" for the section (I think you've already done that...).

Then I'd draw vertical line seperator segments in the section detail. Now the vertical lines are also drawn automatically.

That leaves the bottom line on a page of the report where a section is more than 1 page long. I'd draw that line using the Line method in the On Page event for the report:

Private Sub Report_Page()

If Me.Page <> Me.Pages Then
Me.ScaleMode = 5
Me.DrawWidth = 30
Me.Line (0, 10)-(7, 10), RGB(0,0,0)
End If

End Sub

For this example to work, the report must include a text box for which the ControlSource property is set to the expression =Pages. If you have a text box with the control source set to ="Page " & [Page] & " of " & [Pages], that also works.

hth,
 
What I have done is drawn a line at the bottom of the details section so that a line is drawn at the end of the section - no matter what page it ends on. If the section ends at the middle of the page, that is where the line is drawn - Which is fine.

I have information in the page header (which has a box around it - worked great since it doesn't grow) The page header contains information about the Inspection as a whole.

The detail section has information about a single finding. Some of the findings have enough information that it covers more than 1 page. I am trying to figure out a way to have a line drawn at the bottom of any page in which the detail section doesn't end. I thought about drawing the line in page footer section but would have a floating line on the pages where the section ended - unless there is a way to hide the line if that is the page that the detail section (for that finding) ends on.

I have seen examples of this being done but can't seem to find them again. I am fairly new to VBA and follow simple examples.

I will keep looking :-)
 

Users who are viewing this thread

Back
Top Bottom