Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Access 2010 subreport problem

Posted on 2013-01-06
7
Medium Priority
?
1,378 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
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!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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