By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,503 Members | 2,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,503 IT Pros & Developers. It's quick & easy.

Keep SUBREPORTS together on preview/print without Grouping?

P: 32
Progressing well until this new hurdle.

My REPORT is for a single record. The rptMAIN contains aprox 30 subREPORTS all with Height set to 0" with can grow/shrink. The limit with header/footer groups is about 20 total so can't go that route. Only subREPORTS that have data appear in ReportView and preview/print so the Report is only as many pages as needed per record. Works great thanks to my Bytes friends! The ISSUE NOW IS that if whichever subReport is at the bottom of a page won't fit on the page in its entirety, the subReport breaks and continues on the next page. Tried "keep together = yes" for the subReport (the sub's detail settings on rptMAIN) but no joy. Some posts say the "keep together" works only with Grouping. How do I prevent subReports from breaking across pages?
Jul 6 '18 #1
Share this Question
Share on Google+
10 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,061
If it’s too big to fit on one page, you will get two pages. There is no way to change that.
Jul 6 '18 #2

P: 32
The number of pages I get in a report is of no importance. The problem is having any page break a "subreport" across 2 pages. In essence, if the "subreport" won't fit ENTIRELY on any page, I want that entire "subreport" to move to the next page. No individual subreport is more than a single page long. Also.....Hello again twinnyfo!
Jul 6 '18 #3

twinnyfo
Expert Mod 2.5K+
P: 3,061
Try changing the settings in the sub report itself. If its settings are to keep together as a group, it may force the entire sub report to move to the next page.

It still sounds kind of wonky to have 30 subreports on a main report. You really need to look at restructuring your DB. Otherwise, you will continue to run into additional problems such as this and others.

I know you have already been warned about the dangers of a poorly designed DB, but I will tell you from experience, the longer you wait to fix your structure, the more headaches you will have and the more difficult it will be to fix.

Most often, the best plan is to slow down, assess your requirements, determine the best structure and design around good principles. No amount of help here can replace that. We are glad to help, but just know that we are simply addressing symptoms, and not attacking the sickness itself.
Jul 6 '18 #4

P: 32
If I knew what I was doing when I started this, I would have done it differently in terms of structure and normalization. So far, it has not been determined that any of my issues are/were the result of the structure even if it is "abnormalized", but I hear you. 30 subreports was the approach I took in order to have each the originating data entry FORM and the REPORTS customized based upon "sections" that the user needs only. In fact, it functions better than expected and with elegance (to the users)...EXCEPT for this as yet unresolved printing glitch.

As I described in the original post, each subReport ("DETAIL") is already set to "keep together".
Jul 6 '18 #5

twinnyfo
Expert Mod 2.5K+
P: 3,061
If you have any types of grouping on your Forms, the group headers and footers need to be set to "Keep Together" as well.

You could also simply include Page Breaks at various points when you want to set a new section/subreport to the next page. This will produce a Report that will aways have "Section 4 on Page 3", etc.

Hope this hepps!
Jul 6 '18 #6

P: 32
Thanks. I starting to suspect that there is no way to solve my issue as described. Evidence includes that I can find no posts anywhere that DO NOT require groupings. Access says one can have as many "subreports" as desired, which as said, overcomes the limitations of Grouping and quantity of pages. I know I can place page breaks, but that essentially forces a subreport to a new page. The combination and quantity of subreports that HAVE DATA (and thus will grow and appear on the Report) can vary considerably for each record. So ..... the hunt continues!
Jul 6 '18 #7

PhilOfWalton
Expert 100+
P: 1,430
With normalisation, you would probably have one continuous sub report, which would allow about 40 lines on a piece of A4 paper

Phil
Jul 6 '18 #8

P: 32
Thanks Phil. How can that solve my issue? Here, I going to call what are current "subREPORTS" to be just generically "SECTIONS" (not GROUPED with headers/footers). There are about 30 of these "sections". The data entry form lets users complete ONLY those "sections" that apply to the Record they create. Only the "sections" with data will appear on the Report. If all 30 are in one subreport, how can I control the that only the "sections" with data will appear? What would keep those "sections" from breaking across 2 pages as is my current issue?
Jul 6 '18 #9

NeoPa
Expert Mod 15k+
P: 31,186
Unfortunately I don't have any examples of printing SubForm/Report objects within a Report. However, I don't believe they have the facility for specifying whether or not to throw a new page depending on whether or not they fit wholly on a page of the report.

Without that, as that's exactly what you'd be looking for in a situation like this, you're a bit stuck I'm afraid. You may be able to find a way to insert a new line using VBA code in one of the Format or Print event procedures but I can't think of a way. I have to say my experience in this area is limited as I haven't played there much, but my expectation is that it just can't be done. Happy to be proven wrong of course ;-)
Jul 6 '18 #10

Rabbit
Expert Mod 10K+
P: 12,315
Following on NeoPa's suggestion, maybe there's a 90% workaround by combining those events with a check of the control's height and vertical location.
Jul 6 '18 #11

Post your reply

Sign in to post your reply or Sign up for a free account.