Detail Question

  • Thread starter Thread starter David W
  • Start date Start date
D

David W

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?
 
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
 
This didnt work, I didnt tell you something that was important.
The report has a subreport in it.
I put the code in the subreport and it still didnt work.
The subreport has all of the data in it. The main report I am using for a
other information that is not available in the subreport.
What do I need to do to repair this?
Duane Hookom said:
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?
 
There is no On Page event that runs in a subreport. You could try move the
code to the On Format of the subreport's Report Header. This assumes your
subreport is always one page or less.

--
Duane Hookom
MS Access MVP


David W said:
This didnt work, I didnt tell you something that was important.
The report has a subreport in it.
I put the code in the subreport and it still didnt work.
The subreport has all of the data in it. The main report I am using for a
other information that is not available in the subreport.
What do I need to do to repair this?
Duane Hookom said:
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?
 
Back
Top