Solved

Empty Subform not displayed when printing Form

Posted on 2008-10-01
17
2,009 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
ID: 22613960
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
ID: 22615239
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
ID: 22617181
Try setting the CanGrow/CanShrink property of your subreport control to Yes/No ...
0
 

Author Comment

by:talkingbob
ID: 22618954
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
ID: 22643519
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
ID: 22649318
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
ID: 22651280
OK,

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

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22652009
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:talkingbob
ID: 22658661
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
ID: 22663389
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
ID: 22686151
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
ID: 22686916
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
ID: 22750227
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
ID: 22750599
Did you try the putting tha lable above the Subreport? it will work.
0
 

Author Comment

by:talkingbob
ID: 22987991
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
ID: 22989113
Then you should select his answer, award points, and close this question.
0
 

Author Closing Comment

by:talkingbob
ID: 31501950
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

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

920 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

14 Experts available now in Live!

Get 1:1 Help Now