• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2307
  • Last Modified:

Empty Subform not displayed when printing Form

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
talkingbob
Asked:
talkingbob
  • 7
  • 6
  • 3
  • +1
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
talkingbobAuthor Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Try setting the CanGrow/CanShrink property of your subreport control to Yes/No ...
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
talkingbobAuthor Commented:
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
 
Jeffrey CoachmanCommented:
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
 
talkingbobAuthor Commented:
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
 
Jeffrey CoachmanCommented:
OK,

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

JeffCoachman
0
 
Jeffrey CoachmanCommented:
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
 
talkingbobAuthor Commented:
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
 
Jeffrey CoachmanCommented:
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
 
talkingbobAuthor Commented:
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
 
Jeffrey CoachmanCommented:
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
 
bjmatushCommented:
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
 
Jeffrey CoachmanCommented:
Did you try the putting tha lable above the Subreport? it will work.
0
 
talkingbobAuthor Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Then you should select his answer, award points, and close this question.
0
 
talkingbobAuthor Commented:
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

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 7
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now