Solved

MS Access 2010 subreport problem

Posted on 2013-01-06
7
1,271 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
  • 3
  • 3
7 Comments
 
LVL 29

Expert Comment

by:IrogSinta
Comment Utility
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 39

Expert Comment

by:als315
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 29

Expert Comment

by:IrogSinta
Comment Utility
This works:
Me.Detail.Visible = False
0
 

Author Comment

by:MonkeyPie
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
Great.  All good. Now. Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

743 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

18 Experts available now in Live!

Get 1:1 Help Now