Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Empty Subform not displayed when printing Form

Posted on 2008-10-01
17
Medium Priority
?
2,258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 3
  • +1
17 Comments
 
LVL 85
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 85
ID: 22617181
Try setting the CanGrow/CanShrink property of your subreport control to Yes/No ...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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
 

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 798 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 85
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

618 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