0

I've got an Access 2007 database where I created a report showing projects (using tblProjects). I then created a sub-report showing project history (using tblProjectHistory). The sub-report is linked to the parent report by fldProjectID (tblProjectHistory) and projectID (tblProject).

The layout is such.

::Project information

--> project history information

++++++++

::Project information

--> project history information

(repeat)

The projects list out correctly, and any project history is also appropriately underneath the respective project. No overlap at all.

I'm wanting to limit the number of project history records in the sub-report to no more than 5 for each project. I've tried modifying the sub-report record source to have "TOP 5" in it. but then it ends up limiting the overall number of sub-report records - no matter if they are under one project or not.

Any idea how I could accomplish that mission? Thank you in advance for your time.

1 Answer 1

1

You were on the right track with TOP 5 but I can't think of a way you can do this using the tables themselves as a datasource for the subreport.

I would recommend using a query as the data source for the subreport based on the project ID in the report WHERE projectID = [reports]![reportname]![report project ID field]. You will then be able to group relevant records together by project and select the TOP 5 records for the subreport.

1
  • damn that worked. to recap: I created a query for the sub-report, and in the SQL I put TOP 5. Then based the sub-report off of that query. I could have swore I tried that before - I might have tried it as part of a join (in one of my dozens of attempts). thank you!
    – Chasester
    Mar 18, 2014 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.