Solved

suppressing page break on last item in group - access report

Posted on 2012-04-12
7
599 Views
Last Modified: 2012-04-13
Hi Experts:
I have a report with multiple breaks. For simplicity sake, I'll keep the question refined to three breaks:
Group Header
   Location Header
      Plan Header
      Plan Footer (new page)
   Location Footer (new page)
Group Footer  (Group totals > inserted page break > fancy page finalizing group)

My problem:  When the last Location comes in for the Group, I don't want a page break. I want the Group totals to appear directly under the location totals, then, the inserted page break will take care of printing the fancy page all by itself.  How do I prevent the final Location within the group from breaking a page?   Is there an event that the last Location will trigger that I can interrogate?  
e.g., If Location.Last_Record = true then
        else new page
Thanks,
Betty
0
Comment
Question by:cninghm
  • 4
  • 3
7 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37838021
I believe there may be a simple solution...
Can you post a simple sample of the DB
Also note that using a Group called "Group" is confusing...

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Compile the code. (From the VBA code window, click: Debug-->Compile)
10. Run the compact/Repair utility.
11. Remove any Passwords and/or security.
12. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
13. Post the explicit steps to replicate the issue.
14. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

JeffCoachman
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 37838133
Among some techniques is to count the number of records (In the entire report, or the group or, whatever) then use code to turn off the page break:

Private lngprvtRecCount As Long

Private Sub Report_Open(Cancel As Integer)
    'Get a count of all the records
    lngprvtRecCount = DCount("*", "Orders")
End Sub

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    If Me.txtRecCount = lngprvtRecCount Then
        'No Page break
        Me.Section(6).ForceNewPage = 0
    Else
        'Page break, after section
        Me.Section(6).ForceNewPage = 2
    End If
End Sub



But again a sample would be a lot easier to work with...
0
 

Author Comment

by:cninghm
ID: 37838215
Jeff:
On the "Group" thing.  I agree, but it's an inherited nightmare and I have limited time (no time to re-design).

On the posting example, I cannot - confidentiality.
I'm working with users to convince them of alternative design in report.  Thought it might be something simple.  
I will keep your suggestion in mind and get back to  you.
Thanks,
Betty
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37838260
<On the posting example, I cannot - confidentiality.>
See steps 8.
I only need a database that *Replicates* the issue...
0
 

Author Closing Comment

by:cninghm
ID: 37842837
Jeff:
The users are ok with 3 blank lines between breaks instead of page break.  I accepted your solution since I believe it would work if they insisted on the break.  
Thanks,
Betty
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37843315
ok

Enjoy the weekend
0
 

Author Comment

by:cninghm
ID: 37843512
You too, buddy!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now