Results 1 to 7 of 7
  1. #1
    JackA is offline Novice
    Windows XP Access 2000
    Join Date
    Jul 2011
    Posts
    10

    Records per Page in a Report

    Hi there,

    I am trying to put a page break/set the number of records per page for my report.

    I have two group headings (a and b) and the details section.



    I would like the page break to occur after there has been 2 records in the "group heading b" and for those records of "group headings of b", all of the details sections are complete.

    i.e. In the diagram attached, where the green arrow is. I have also included a diagram for the design view too.

    I have tried using this formula below with a text box in "group heading b". However when it creates the pagebreak, only one of the records occurs in the details section (not all 4).

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

    If [txtcounter] Mod 2 = 0 Then
    Me.Detail.ForceNewPage = 2
    Else
    Me.Detail.ForceNewPage = 0
    End If

    End Sub

    Can anyone help?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Google: vba report force page break

    Maybe this will help:
    http://thedailyreviewer.com/office/v...orts-103251718
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Here's an additional reference for conditional page breaks:

    http://en.allexperts.com/q/Using-MS-...eak-report.htm

  4. #4
    JackA is offline Novice
    Windows XP Access 2000
    Join Date
    Jul 2011
    Posts
    10
    I have tried the links you sent but nothing helped :S

    It seems like mine is specific problem.

    Using the formula I have mentioned already, is there any way I can adapt it to forcepagebreak before mod=3, instead of when mod =2 ?

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    If you put the page break after all the data in your form it should work as you want. The mod function returns the remaining value after you have divided by the number in the formula so in your case if the record number (second record) mod 2 = 0 then the page break is visible. What exactly 'isn't working' about it? is the first page showing one record then every page after that showing 2?

  6. #6
    JackA is offline Novice
    Windows XP Access 2000
    Join Date
    Jul 2011
    Posts
    10
    Thanks for your response.

    Please see the images that I originally attached to explain my problem further.

    As you can see I have a group header and a detail section. For every group header record, 4 sub records are produced in the detail section.

    I would like the page break to occur after there have been two records in the group header section (and all of their sub records are produced).

    However, adding the page break as described before (i.e. textbox in group header with running sum and event in group header that creates pagebreak after "2") does not create the desired effect. Instead it creates the following,

    1 record in group header with its 4 sub records in detail
    1 record in group header with 1 sub record + page break + 1 sub record + page break + 1 sub record + page break + 1 sub record + page break

    1 record in group header with its 4 sub records in detail
    1 record in group header with 1 sub record + page break + 1 sub record + page break + 1 sub record + page break + 1 sub record + page break

    etc

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Can you post a sample database?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple records on a single page
    By neo651 in forum Forms
    Replies: 1
    Last Post: 06-29-2011, 10:21 PM
  2. show 4 records in each report page
    By kareem_h in forum Reports
    Replies: 5
    Last Post: 11-10-2010, 10:11 PM
  3. Page break on report inserts empty page between
    By Galadrielle in forum Reports
    Replies: 0
    Last Post: 07-07-2010, 04:18 AM
  4. Replies: 1
    Last Post: 05-22-2010, 08:30 PM
  5. Moving through records via Page Down
    By Robert M in forum Programming
    Replies: 4
    Last Post: 07-28-2009, 09:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums