Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print three record per page 1

Status
Not open for further replies.

Rainer2000

IS-IT--Management
Apr 27, 2003
61
DE
Hi,
I have created a tricky report (with the help of this forum) and there is just one more item which causes a problem.

Since there must only be 3 records/page I have made the page small enough so it would print only 3 records. But now the first page (the page header since it has a different layoout) is missing one field which is right at the bottom of the page.

If I could always force a page brake in the detail section after 3 records I think this will solve this issue. I could then make the page larger and still have only 3 records.

Your ideas and comments would be highly welcome.


Rainer


 
How about adding a PageBreak called, say, PageBreakX, then:
Code:
'Declaration
Dim intCount

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If intCount = 4 Then
    Me.PageBreakX.Visible = True
    intCount = 1
Else
    Me.PageBreakX.Visible = False
    intCount = intCount + 1
End If

End Sub

Private Sub Report_Open(Cancel As Integer)
Me.PageBreakX.Visible = False
intCount = 2
End Sub

The idea is from a post by MichaelRed, who pointed out that an invisible page break is not acted upon.
 
Hi Remou,
This is the way I executed it:
I inserted a page break into the detail section and called it Pagebreak2.

This is the complete code I am using:

Option Compare Database
Private rCount As Integer
Dim intCount

Private Sub Berichtsfuß_Format(Cancel As Integer, FormatCount As Integer)

rCount = 0
End Sub


Private Sub Detailbereich_Format(Cancel As Integer, FormatCount As Integer)
rCount = rCount + 1
If rCount = 1 Then Cancel = True

'############
'If intCount = 4 Then
If intCount = 3 Then
Me.Pagebreak2.Visible = True
intCount = 1
Else
Me.Pagebreak2.Visible = False
intCount = intCount + 1
End If
'############

End Sub

Private Sub Report_Open(Cancel As Integer)
Me.Pagebreak2.Visible = False
'intCount = 2
intCount = 2
End Sub


I need the rcount procedure to jump to the second record on the detail section. This may screw-up your code.

With the present configuration Page 1 which is the page header comes out ok. Page 2 (from the detail section) has three records as desired. All following pages have only two records.

Rainer
 
I am not sure I properly understand what you are doing, but here goes anyway. In order to get three records, you need "If intCount=4". However, you seem to be doing something different on page two, due perhaps to the rcount thing, so perhaps an "If page = 2" is needed?
 
Hallo Remou,

I changed the "incount" back to 4,
And with this configuration Page 2 has 4 records all the following have 3. Could you assist how to insert the "If page=2" statement?
Going so deep is beyond my capabilities.

Rainer
 
Here is a bit of 'fuzz'
Code:
    If Me.Page = 2 And intCount = 3 Then intCount = 4
    
    If intCount = 4 Then
        Me.PageBreak38.Visible = True
        intCount = 1
    Else
        Me.PageBreak38.Visible = False
        intCount = intCount + 1
    End If
 
Hello Remou,

Just to let you know that it works perfect now! Thanks a lot for your valuable help.

Rainer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top