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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PageBreak after 10 records??

Status
Not open for further replies.

thegameoflife

Programmer
Dec 5, 2001
206
US
In my detail section I'm wanting to force a new page if the detail section is greater than 10 records. Here is the code I was trying to use...
Code:
pagebreak = (text91 Mod 10) = 0
 
From Access Help:

1 Open the report in Design view.

2 In the toolbox, click Page Break , then click in the report section where you want a conditional page break.

3 Open the report's PageHeader_Format event procedure.

4 In the event procedure, add an assignment statement that sets the Visible property of the page break control to No. For example, if the name of the control is CondPgBreak, add the following assignment statement:

Me![CondPgBreak].Visible = False

This hides the page break control when the report starts formatting each page, so the page doesn't break.

5 In the Format event procedure of the section where you placed the page break, add Visual Basic code that sets the Visible property to Yes when a condition is met. For example, suppose you want a page break to occur in the detail section of the report if the value of the Counter control is 10, so that the first 10 records will print on the first page. Add the following code to the Detail_Format event procedure:

If Me![Counter] = 10 Then
Me![CondPgBreak].Visible = True
End If

When the condition is met, the page breaks. After the page is broken, the event procedure attached to the page header hides the page break control until the condition is met again.
 
for some reason it's only repeating one record on if the code meets the criteria.

Code:
'This is how I'm getting the count of recods in the detail section. text91
=DCount("Filled","QR_Total_FC","[member#]=text50")
----------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me![Text91] > 10 Then
        Me![condPgBreak].Visible = True
    End If
          
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)

Me![condPgBreak].Visible = False

End Sub
 
The
Code:
Me![condPgBreak].Visible = False
statement should go in the On Format of the Page Header section.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top