Solved

Empty Subform not displayed when printing Form

Posted on 2008-10-01
17
1,986 Views
Last Modified: 2013-11-29
Hello,

I have an Access Database that has a three subforms on a single form. When I print the form and the subform has no records, it does not print the subform (there is just a big empty area where it should be printed).

I found MS KB Article 209028 which seems to describe the issue I am having in general, but I checked the properties of the subform, and it was already set to display always.

Is there any way that you can force a subform to show up when printed no matter what is in it? I already have a print button on the form that I could attach VBA event code to if need be.

Thanks in advance everyone!
0
Comment
Question by:talkingbob
  • 7
  • 6
  • 3
  • +1
17 Comments
 
LVL 84
Comment Utility
A form is not designed to be printed, which is why you have some odd behavior when doing this. A report is designed to be printed; you can save a copy of your Form as a REport (just copy/paste the report in the database window, and you'll be prompted to Save As).

You could then open your report as such:

DoCmd.OpenReport "Yourreport", acViewPreview, , "YourIDField=" & Me.YourFormsIDVAlue

0
 

Author Comment

by:talkingbob
Comment Utility
I followed your advice and got a report created. I set the VBA Code on the print button on the form to run "DoCmd.OpenReport..." like you had above, but it now the "subform" does not display in print preview in the REPORT!
I could not find a property in that section of the report that would affect that "subform" from showing up in the print preview of the report.

I am not certain why the report is now doing the same thing that the form was doing when printed.

Any other ideas would be greatly apprecitated. Thank you.
0
 
LVL 84
Comment Utility
Try setting the CanGrow/CanShrink property of your subreport control to Yes/No ...
0
 

Author Comment

by:talkingbob
Comment Utility
CanGrow is set to YES... CanShrink is Set to NO.

The thing that perplexes me the most is that it works great as a report if there is DATA in the subreport (just like on the form). Is there any property that would get copied over when I Saved As a report?

I am really pulling my hair out on this one...
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
talkingbob,

  "but it now the "subform" does not display in print preview in the REPORT!"

Do you mean it *NEVER* displays, or does not display when no reords are present.
Please clarify.

By default the Sub"Report" will not appear if there are no records in the parent Report.
A Subform *Will* appear for every parent record, but it will display 0 records.

How are your table joins setup?

Can you post a screenshot of both the missing Subform and the missing subreport?

JeffCoachman
0
 

Author Comment

by:talkingbob
Comment Utility
Jeff,

The problem only happens when there are no records present.

Attached is a screenshot of the missing subreport, subform, and properties of the subreport (showing the links to the main report).


Thanks.
no-subform.JPG
subform-prop.JPG
no-subform2.JPG
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
OK,

Thanks, I'll load up  sample 2007 Report and test this out.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
talkingbob,

You never really presented a screenshot that showed a subreport with records with a subreport without records.
Nor did you post a screenshot of your report in design view.
(But to be honest, I never asked for this specifically)
;-)


In Access 2007, by default, a Parent record that has no child records, will not display the subreport.

If you have: "a big empty area where it should be printed"
Then this says to me that you may have tried to size the subreport's height larger than it had to be.

For example, in design view the subreport does not really need that much height at all.

Here are my screenshots:
Notice that my subreport has almost no height in design view, but displays varying numbers of child records just fine.

Also, note that Customer "FISSA" has no child records, and no "Big empty Area" exists.

So my question is that if your report is set up like mine, then is you should not really have a "Big empty Area".
So is your ultimate goal to still show the subreport even if it has no records?
If so, why?
How *Exactly* would you want a Blank subreport displayed?
I mean, if there are no records, then literally, there is nothing to display.

Please clarify.

JeffCoachman

Main-Report-with-Sub-report-in-d.JPG
Main-Report-with-Sub-report-in-P.JPG
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:talkingbob
Comment Utility
Jeff,

I think this is the Key issue that I want resolved:
================================================================================
In Access 2007, by default, a Parent record that has no child records, will not display the subreport.
================================================================================

Is there any way to display the subreport?

Also, the only reason I am using a report instead of printing a form is due to the first comment I received from LSMConsulting that stated reports were made for printing. If the same thing can be done when printing a form, I would rather just stick with that.

I am uncertain how decreasing height in Design Mode makes the printout any more useful than the "big white area" - they both do not display any part of the materials subform/subreport.

I have attached a screenshot of the closest I've gotten to what I want displayed. Basically, if there are no records, display the headers (underlined words).

Also, I think you wanted the form in design view, so I have attached that as well.
closest-to-what-i-need.JPG
design-view.JPG
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
talkingbob,

  "I am uncertain how decreasing height in Design Mode makes the printout any more useful than the "big white area" - they both do not display any part of the materials subform/subreport."
My feeling is that since the subreport really does not need any height at all, so why waste time making it taller?
Again, I'm confused?
Do you want the "Big empty space" or not?

"if there are no records, display the headers (underlined words)."
Well, this is not the same thing as displaying the subreport, as you asked previously.

If you want to just see the name of Subreport, then simply change the Label above the SubReport to the "Header" text (or whatever you want it to be).

Since the label always "displays" by default, why not just use it for your purpose?
;-)

Jeff
ChangeSubReport-Label.JPG
0
 

Author Comment

by:talkingbob
Comment Utility
Jeff,

It sounds like I am asking to do something that is impossible. I guess I will just have to create a label that goes BEHIND the sebreport, so that if the subreport doesn't have any records, the label behind it will appear, thus allowing what would look like "headers" to appear.

If there is any way I can get the structure and non-data elements to display, I would still rather do that.
Thank you for your time and effort with this issue.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 266 total points
Comment Utility
Depending on where you put this Label, it might "Show Through" the subreport.
It must be Physically above or below the SubReport.

You will have to write code to detect if the subreport has records or not, then hide or show the Label where appropriate.

Are you OK with doing that?

JeffCoachman
0
 

Expert Comment

by:bjmatush
Comment Utility
I am having the same problem.  I have a report with a subreport on it.  The subreport is bascially a grid of numbers and if any of the values in a ZERO OR a NULL...then the sureport will not show up...and sometimes things have to be zero or null.  If I go back and change the problem value to something other than zero or null...then the report will once again show up....PLEASE HELP
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Did you try the putting tha lable above the Subreport? it will work.
0
 

Author Comment

by:talkingbob
Comment Utility
Even though I am having the same issue as BJMATUSH, I no longer need a solution.

Thank you everyone for your help. I think what boag2000 was suggesting is the answer, but I no longer have a need or desire to pursue any other solutions at this time.

0
 
LVL 84
Comment Utility
Then you should select his answer, award points, and close this question.
0
 

Author Closing Comment

by:talkingbob
Comment Utility
I am more than ok with coding, but the initial issue is no longer an issue.

Thank you for your prompt responses!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

772 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