Quote:
Originally Posted by wattar
Hi all,
I will briefly tell you about the structure of my databse, and then will ask you my question.
I have a database for project tracking, with a table for projects, and some other tables related to the projects table (i.e. Milestones)
I have a report based on a query that selects all the projects that I have and the report is grouped by the project ID. Within this report, I have a subreport for Milestones. the query for the Milestones subreport selects all the project milestones where the project ID = the "Report" ProjectID. This makes the Milestones subreport pick only the milestones for each project ID as per the grouping done in my parent report.
The Problem:
Some projects have no milestones!
I end up having a page in the report where on the top of the page, there is the project name and nothing below it. So of course this doesn't look very presentable.
The Question:
Is there a way using VB or access to completely skip such pages from the repot so I would end up with a report for all projects that actually have milestones?
Thanks for your help!
Wael
If I understand this correctly there is no milestone data currently present in the main report records. If this report is currently based on the table change it to a query or if it may already be a query.
Either way you need to add the milestones table to the query not as a returned field but as criteria only. And exclude null values.
Something like this:
-
-
SELECT ProjectID, Field1, Field2, etc
-
FROM ProjectTable LEFT JOIN MilestoneTable
-
ON ProjectTable.ProjectID=MilestoneTable.ProjectID
-
WHERE MilestoneID Is Not Null;
-
This will only return projects with milestone records.
Can also be written like this (as per NeoPa's suggestion)
-
-
SELECT ProjectID, Field1, Field2, etc
-
FROM ProjectTable INNER JOIN MilestoneTable
-
ON ProjectTable.ProjectID=MilestoneTable.ProjectID
-