Jim Dettman
jimdettman at earthlink.net
Tue Jan 10 07:39:39 CST 2006
Hi Mike, <<When a report is printed, any textual or graphical sub-report which starts before the end of the page is "split" i.e.. part of it prints on the page it started on and the rest prints on the following page. This is particularly horrific when a graph is being printed - the "pie" ends up not only sliced but also severed! I think I can live with textual type reports being split across pages, but splitting a graph into 2 parts isn't acceptable.>> I'm going to suggest something and it may solve it with a little experimentation, but if it doesn't it will certainly get you started in the right direction. First, what your seeing is more or less normal report engine behavior, so there is no easy fix for this (i.e. no setting to change) and your going to need to mange this problem on your own. The Access report engine is quite controllable, much more so then many people think. You've already seen some of that with hiding/un-hiding sub reports with no data. I'm going to toss out three things that you can use to control reports and when combined, you'll be really surprised at some of the things you can do. 1. "Two Pass" printing - This is where by placing a reference to .Pages anywhere on the report, you force Access to do a dry run of the report to figure out the total number of pages. It then does a second pass to actually print the report. What's interesting with this is that on the first pass, you can build a table of contents, find what page sections will fall, the number of sections, which will print or not, etc and store that in a temp table. Then on the print pass, use the built temp table to drive printer logic. One big gotcha here: You should have no code in the OnPrint event that would affect the print layout. The reason is that on the first pass, Access does not fire the OnPrint event at all for any section. So all your conditional code needs to be in a OnFormat event. 2. Use of: MoveLayout property - specifies whether Microsoft Access should move to the next printing location on the page. NextRecord property - specifies whether a section should advance to the next record. PrintSection property - specifies whether a section should be printed. 3. Use of: Top property - Tells you how far down the page you are Left property - Tells you what column your in So where does this all get us? What I see is this: Do a two pass report, and record the size of each subreport in inches of page that it occupies. Store that info in a temp table. On the second pass, use the temp table info and the Top property to determine if you have sufficient space left on the page to print the graph. If not, use MoveLayout = True, NextRecord = False to skip down the page until a new page is forced or hide/un-hide a page break control. I believe that will work. As I said though, it may require some experimentation to get it to work right. If your willing to give it a go, I'll go into more detail. In the meantime, I'll give it some more thought and see if there might be an easier way. Let me know, Jim. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mike Sent: Monday, January 09, 2006 5:45 AM To: accessd at databaseadvisors.com Subject: [AccessD] Report Printing Problem - Graphs Being Split Hi Folks. I've been a "lurker" here for some time now - and have benefited enormously from the knowledge shared in AccessD. Please accept my thanks for the effort each and everyone of you puts into this list. I'm still trying to find a question I can help with - although by the time I get to see the questions they have generally been answered! <<snip>>