Report View/Print Preview (sub report) Problem

ShawnH

Registered User.
Local time
Today, 00:41
Joined
Aug 26, 2011
Messages
11
Hello, I have a problem with a report and I was hoping someone can help me out.

I have a report that has several sub reports. It could be possible that sometimes the sub report(s) returns with no records, which is fine. When viewing the report in report view, the sub report is displayed with no records (this is what I want) but when viewed in print preview, it's not there and it is causing calculation problems in my main report.

I run calculations from the sub reports to get a cost estimate on the main report and when the report is not displayed in print preview, it returns "#Error". I need what is displayed in the report view to actually print. Or find how I can run my calculations if it doesn't load in print preview and printed.

I've attached my database so you can see what I have. The report is called rpt_TDY_Summary.

Any help would be greatly appreciated.

Thank you!
 

Attachments

I've sorted out your visible problem. The idea is I:

1. cloned your rpt_sub_Instructor_Summary report and called it rpt_sub_Instructor_Summary_BLANK.
2. Got rid of the report's Record Source and the Control Sources of all the controls
3. Entered a static value of 0 in all the Totals controls.
4. Cloned the subreport control on your main form and changed its record source to the new subreport (i.e. rpt_sub_Instructor_Summary_BLANK) and removed the Link Master/Child Fields.
5. Set the Can Shrink and Can Grow properties of this cloned subreport to No.
6. Made sure that the Can Shrink and Can Grown properties of rpt_sub_Instructor_Summary is set to Yes.
7. Set the Back Colour of all the sections in rpt_sub_Instructor_Summary to White. This will ensure that this report stays on top when it has data.
8. Moved the cloned subreport into place by copying the Top value of rpt_sub_Instructor_Summary and putting in the Top property of the clone.
9. Sent the cloned subreport control to the back and brought the original one to the front.

That's it!

For your #Error problem, follow this link: http://access.mvps.org/access/forms/frm0022.htm
 

Attachments

Thank you!

This is how I fixed the #Error

=IIf([subreport name].Report.HasData,[subreport name].Report![control],0)
 
Well, not sure how you did. I get #Name.
=IIf([SubreportName].[Report]![FieldName].[Report].[HasData],[SubreportName].[Report]![FieldName].[Report]![control],0).
Any idea why?
 
This is the IIf statement that I used

=IIf([subreport name].Report.HasData,[subreport name].Report![control],0)
 
Thanks. Can I just check that your word 'control' equals my word 'field'?
 
Sorry: not thinking clearly. Now I see this wasn't correct. This is in a text box referring to a sub-report.
=IIf([subreport].[Report].[HasData],[ subreport].[Report]![Field].[control],0). Still shows #Name.
 

Users who are viewing this thread

Back
Top Bottom