Link to home
Start Free TrialLog in
Avatar of MonkeyPie
MonkeyPieFlag for Australia

asked on

MS Access 2010 subreport problem

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.
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

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.
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.
Avatar of MonkeyPie

ASKER

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.
This works:
Me.Detail.Visible = False
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)
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great.  All good. Now. Thank you.