Repeat contents of Detail to end of page

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I have added horizontal and verticle lines to a report in
order to get it to appear as a table when it is printed. I
need that "table" to continue to the end of the page even
if there are no records to fill the "cells" of that table.
Is this possible. Thanks
 
You can use the Line method of the report to draw the lines with code:
'---------------------------------------------------------------------------
------------
' Procedure : Report_Page
' DateTime : 8/9/2004 14:13
' Author : hookomd
' Purpose :
'---------------------------------------------------------------------------
------------
'
Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNum As Integer
Dim intDetailHeight As Integer
Dim intPageHeadHeight As Integer
On Error GoTo Report_Page_Error

intNumLines = 30
intDetailHeight = Me.Section(acDetail).Height
intPageHeadHeight = Me.Section(3).Height
For intLineNum = 1 To intNumLines
Me.Line (0, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(Me.Width, 0)
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
 
Jason said:
I have added horizontal and verticle lines to a report in
order to get it to appear as a table when it is printed. I
need that "table" to continue to the end of the page even
if there are no records to fill the "cells" of that table.
Is this possible.


Another way to do what you asked is to use the section's
Format event to cause the section to be printed multiple
times.

In order to know when the format event is processing the
last record, you need to add a text box named
txtTotalDetails to the report (or group) header with the
expression =Count(*)

Next add a text box named txtCountDetail to the detail
section, set its control source expression to =1 and
RunningSum to Over All (of Over Group).

With that in place, you can use code like the following air
code in the detail section's Format event:

Dim intExtra As Integer

Sub Detail_Format( . . .
If txtCountDetail >= txtTotalDetails Then
If Me.Top < 9 * 1440 Then 'fit on page?
If intExtra = 1 Then
'first blank row
Me.txtbox1.Visible = False
Me.txtbox2.Visible = False
. . .
End If
intExtra = intExtra + 1
Me.NextRecord = False
Else
' last row on page
intExtra = 0
End If
Else
' process normal details here
End If
End Sub
 
Back
Top