Solved

MS Access 2010 subreport problem

Posted on 2013-01-06
7
1,312 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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 500 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

726 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