Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
Old 09-09-2011, 07:17 PM   #1
ShawnH
Newly Registered User
 
Join Date: Aug 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
ShawnH is on a distinguished road
Report View/Print Preview (sub report) Problem

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!
Attached Files
File Type: zip Course Database.zip (573.7 KB, 204 views)

ShawnH is offline   Reply With Quote
Old 09-10-2011, 07:56 AM   #2
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Report View/Print Preview (sub report) Problem

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
Attached Files
File Type: zip Course Database.zip (730.5 KB, 164 views)
vbaInet is offline   Reply With Quote
Old 09-11-2011, 06:09 AM   #3
ShawnH
Newly Registered User
 
Join Date: Aug 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
ShawnH is on a distinguished road
Re: Report View/Print Preview (sub report) Problem

Thank you!

This is how I fixed the #Error

=IIf([subreport name].Report.HasData,[subreport name].Report![control],0)

ShawnH is offline   Reply With Quote
Old 09-11-2011, 06:41 AM   #4
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Report View/Print Preview (sub report) Problem

No problemo!
vbaInet is offline   Reply With Quote
Old 11-23-2012, 08:00 AM   #5
cb@chrisb.eu
Newly Registered User
 
Join Date: Mar 2009
Posts: 40
Thanks: 3
Thanked 0 Times in 0 Posts
cb@chrisb.eu is on a distinguished road
Re: Report View/Print Preview (sub report) Problem

Well, not sure how you did. I get #Name.
=IIf([SubreportName].[Report]![FieldName].[Report].[HasData],[SubreportName].[Report]![FieldName].[Report]![control],0).
Any idea why?
cb@chrisb.eu is offline   Reply With Quote
Old 11-24-2012, 04:38 PM   #6
ShawnH
Newly Registered User
 
Join Date: Aug 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
ShawnH is on a distinguished road
Re: Report View/Print Preview (sub report) Problem

This is the IIf statement that I used

=IIf([subreport name].Report.HasData,[subreport name].Report![control],0)
ShawnH is offline   Reply With Quote
Old 11-25-2012, 01:18 AM   #7
cb@chrisb.eu
Newly Registered User
 
Join Date: Mar 2009
Posts: 40
Thanks: 3
Thanked 0 Times in 0 Posts
cb@chrisb.eu is on a distinguished road
Re: Report View/Print Preview (sub report) Problem

Thanks. Can I just check that your word 'control' equals my word 'field'?

cb@chrisb.eu is offline   Reply With Quote
Old 11-25-2012, 02:39 AM   #8
cb@chrisb.eu
Newly Registered User
 
Join Date: Mar 2009
Posts: 40
Thanks: 3
Thanked 0 Times in 0 Posts
cb@chrisb.eu is on a distinguished road
Re: Report View/Print Preview (sub report) Problem

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.

cb@chrisb.eu is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access button to print report instead of opening it in print preview vvangogh Modules & VBA 2 07-01-2011 10:45 AM
Report Default View Print Preview Not Working mimottershaw General 4 11-05-2009 12:16 PM
Report will not open in print preview view mimottershaw Reports 2 11-15-2007 12:33 PM
Report does not print as shown in print preview CMontoro Reports 4 09-20-2006 06:15 AM
Print/Preview current record in report/sub-report azgambit Reports 1 02-15-2004 02:54 PM




All times are GMT -8. The time now is 05:50 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World