Subreports

melanemac

Registered User.
Local time
Today, 18:54
Joined
Feb 17, 2005
Messages
14
OK...I need a bit of help here. I have put everything together for my report, including 4 subreports, but am having a few problems.

I have been scowering the forums here and just can't seem to get these figured out...hoping you can help.

PDF of Report results attached.
Report overview: This is a grouped report and each subreport matches up to the PositionCode field. That works just fine and is pulling the correct data.

Subreports: Each subreport is noted by the headers in grey. The Composite $ Match Info and STRATEGY Salary Range subreports will always show. The remaining two subreports may not have data to show.

Problems:
1. After the 1st page of each report, it is printing out a blank page.
2. The Employees in Position subreport may or may not print out on another page(s). I would like the subreport header to also print out on any additional pages as a header (see page 3 of the PDF). The header is currently a report header. I have tried changing the header of the subreport to a page report to no avail. I want to at least have this show on the 1st page and continue on to others as the report for each position could be 3 or 4 pages, due to the number of employees in each report. I'm at a loss.
3. If one or both of the last two subreports have no data, I would like to show the headers, but nothing else (I can or cannot have a field that says "No Data"...no preference). I have read about HasData in these forums, but I truly am a novice at report writing, so I can't seem to make sense of it. I would need someone to truly give it to me in elementary speak...step by step.

Thanks so much for any help you can offer.
Melane
 
Last edited:
Just a thought...
Could you do two reports instead of one?
I mean that you could do a recordset that goes through your PositionCodes and for each, it prints your main report with it's first three sub-reports, then prints the "Employees in Position" report.
Something like this(Done very fast, will need adjustments to work properly):
Code:
Public Sub PrintReports()
    Dim recPositions As Object
    Dim strSQL As String
    Dim stLinkCriteria as String

    Set recPositions = CreateObject("ADODB.Recordset")    
    stSQL = "SELECT * FROM TPositionCodes;"

    recPositions .Open stSQL, conn, adOpenDynamic, adLockOptimistic
        
    Do Until recPositions .EOF
        stLinkCriteria = "PositionCode = " & recPositions.strPositions
        DoCmd.OpenReport "YourMainReport", acViewNormal, , stLinkCriteria
        DoCmd.OpenReport "EmployeesReport", acViewNormal, , stLinkCriteria
    Loop

    recPositions.Close
End Sub
 
Unfortunately, I have no idea how to write code in Access. I've only ever built reports visually.

Also, I want the beginning of my last subreport to print on that page, because the majority of my positions will only be one page.
 
Last edited:
sub report

Hi melanemac

so you have created the sub report. Dont you want to share you knowledge with me on how to create a sub-report, because i dont know it.

my requirement is simple. in main report i need the sum of all invoices and in sub-report i need list of invoice numbers.
 
That part was easy...

Once in your main report, go the toolbox and choose the subform/subreport button (4th from the end). You will have to create a box in your detail section. That will then guide you through the subreport wizard.

As long as you have a field that will link to your field in the main report, you should be good to go.
 
figured out two of the points...

melanemac said:
Problems:
1. After the 1st page of each report, it is printing out a blank page.
2. The Employees in Position subreport may or may not print out on another page(s). I would like the subreport header to also print out on any additional pages as a header (see page 3 of the PDF). The header is currently a report header. I have tried changing the header of the subreport to a page report to no avail. I want to at least have this show on the 1st page and continue on to others as the report for each position could be 3 or 4 pages, due to the number of employees in each report. I'm at a loss.
3. If one or both of the last two subreports have no data, I would like to show the headers, but nothing else (I can or cannot have a field that says "No Data"...no preference). I have read about HasData in these forums, but I truly am a novice at report writing, so I can't seem to make sense of it. I would need someone to truly give it to me in elementary speak...step by step.

1. I just needed to pull something over...it was pushing another page.
2. When you are in the subreport, instead of creating the column headers in the report header section, you can create a group and place them in the group header. Then you change the RepeatSection property to yes.
3. Still trying to figure out. Any thoughts anyone?

Melane
 

Users who are viewing this thread

Back
Top Bottom