Here is code that draws vertical lines in the On Page event. It relies on
six rectangle controls (Rect1 - Rect6) in the Page Header to position the
top left corner of the lines. The rectangle controls can be invisible.
They are only needed to allow you to move them around in the Page Header
to adjust the drawn lines. You move the controls rather than modifying the
code.
Private Sub Report_Page()
Dim intRects As Integer
Dim intPageHeadHeight As Integer
Dim intPageFootHeight As Integer
Dim intRptHeadHeight As Integer
Dim intLineBottom As Integer
Dim intLeft As Integer
Dim intTop As Integer
On Error GoTo Report_Page_Error
intRptHeadHeight = Me.Section(1).Height
intPageHeadHeight = Me.Section(3).Height
intPageFootHeight = Me.Section(4).Height
'find the y point of the bottom of line
intLineBottom = (11 * 1440) - _
(intPageFootHeight) - _
1440
For intRects = 1 To 6
intLeft = Me("Rect" & intRects).Left
intTop = Me("Rect" & intRects).Top
If [Page] = 1 Then
intTop = intTop + intRptHeadHeight
End If
Me.Line (intLeft, intTop)- _
(intLeft, intLineBottom)
Next
On Error GoTo 0
Exit Sub
Report_Page_Error:
Select Case Err
Case 2462 'no page header
intPageHeadHeight = 0
Resume Next
End Select
MsgBox "Error " & Err.Number & " (" & _
Err.Description & ") in procedure " & _
"Report_Page of VBA Document Report_Report1"
End Sub
--
Duane Hookom
MS Access MVP
--
David W said:
I have put dividing lines in the detail area to divide the data.(Vertical
Lines)
When a report only has a few records, the lines stop in the middle of the
report.
Is there a way to continue the lines to the bottom of the report?