?
Solved

MS Access 2010 subreport problem

Posted on 2013-01-06
7
Medium Priority
?
1,350 Views
Last Modified: 2013-01-06
I have a report based on employee details.  The source is a table I have built specifically for this report - tblEmpCharges.  The user can specify whether or not to 'show details' for each employee.

 The main report is grouped by employee ID, and I show summary info at the employee header level.   I want the report detail to have a subreport which shows the employee details.  If the user specifies don't show details' I intend to set the source of the subreport control to nothing., so only employee summary line will show.

The subreport has exactly the same source as the main report, and I want to set up the parent/child to be EmployeeID.  However, every time I try to insert the subreport into the main report (detail section) Access crashes completely.

I have checked the subreport by viewing it independantly - all good.  Also, main report is fine if there is nop subreport.

So, my questions are:
Can you have a subreport with same source as parent report in the report detail section?
Is there a better way to show or not show employee detail depending on user request?

Thank you.
0
Comment
Question by:MonkeyPie
[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
  • 3
  • 3
7 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38749796
Yes, your subreport can have the same recordsource as your main report.  As to what is causing your report to crash, it's hard to say without seeing your design.  However, I don't see the need for having a subreport to show the employee details.  You can just have the employee details on the main report's Detail section and just make the Detail section invisible accordingly.
0
 
LVL 40

Expert Comment

by:als315
ID: 38749798
May be you can upload sample DB with this table and report? Crash is not expected in your case. I see no problems with same report source.
0
 

Author Comment

by:MonkeyPie
ID: 38749804
Yes, I could do this, but if the subreport detail is say 10 lines of data,and I do as you suggest and add these 10 lines to my main report, making these detail fields invisible would then show 10 blank lines.  Is there a way to just show the summary line with no detail?  I did try to  make the detail section invisible but this didn't work.

I tried me.section(acDetail).visible=false in the form open event, and also in the detail format event - neither worked.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 29

Expert Comment

by:IrogSinta
ID: 38749810
This works:
Me.Detail.Visible = False
0
 

Author Comment

by:MonkeyPie
ID: 38749825
In the report open event?  Or detail-format event?  or other?

I just tried it in report open event and got wierd "report is wider than paper"  error on docmd.openreport line. (although report is not too wide)
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 38749834
On the OnLoad or OnOpen event should be fine. Check your margins as well as the width of your report design. It should not go over 8.5 inches for Letter size paper in portrait mode.
0
 

Author Comment

by:MonkeyPie
ID: 38749877
Great.  All good. Now. Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

762 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