John W. Vinson said:
John W. Vinson said:
I have several queries I wish to combine to one query to creat a report.
These queries are asking for info based on a date. If the result of one query
is empty (no results from that date), then the combined query turns up
completely empty even though individually, the other queries have information.
How can I get the combined query to list all available info and simply have
a blank cell where there is no info?
Thanks
Use a Left Outer Join to join the queries, rather than an Inner Join.
If you would like help doing so, please post the SQL of the queries (which we
cannot see from here!)
John W. Vinson [MVP]
SELECT [Month Civil Active].[Project type], [Month Civil Active].[Proposed
date By Month], [Month Civil Active].[Sum Of Civil Amt], [Month Civil
Active].[Count Of index1], [Month Civil Active].[Project status], [Month
Structural Active].[Project type], [Month Structural Active].[Proposed date
By Month], [Month Structural Active].[Sum Of Structural Amt], [Month
Structural Active].[Count Of index1], [Month Structural Active].[Project
status], [Month Survey Active].[Project type], [Month Survey
Active].[Proposed date By Month], [Month Survey Active].[Sum Of Survey Amt],
[Month Survey Active].[Count Of index1], [Month Survey Active].[Project
status]
FROM [Month Civil Active], [Month Structural Active], [Month Survey Active];
You don't have ANY joins here. This will certainly not work as desired; it
will instead pear every record in [Month Civil Active] with every record in
[Month Structural Active] with every record in [Month Survey Active]! So if
you have 12 records in each query (guessing here) you would get all 1,728
possible combinations.
I'm not sure what your queries contain or what you want to see so I'm not sure
what to suggest. A Report with three Subreports might work; putting a JOIN
line between the queries joining on [Proposed datae by month], using Outer
Joins appropriately (and I don't know what is appropriate for your data) might
also; or if you want to see all the records from the first query, then all the
records from the second, then all the records from the third, a UNION query
may be better.
John W. Vinson [MVP]
SELECT [Month Civil Active].[Project type], [Month Civil Active].[Proposed
date By Month], [Month Civil Active].[Sum Of Civil Amt], [Month Civil
Active].[Count Of index1], [Month Civil Active].[Project status], [Month
Structural Active].[Project type], [Month Structural Active].[Proposed date
By Month], [Month Structural Active].[Sum Of Structural Amt], [Month
Structural Active].[Count Of index1], [Month Structural Active].[Project
status], [Month Survey Active].[Project type], [Month Survey
Active].[Proposed date By Month], [Month Survey Active].[Sum Of Survey Amt],
[Month Survey Active].[Count Of index1], [Month Survey Active].[Project
status]
FROM ([Month Civil Active] LEFT JOIN [Month Structural Active] ON [Month
Civil Active].[Proposed date By Month] = [Month Structural Active].[Proposed
date By Month]) LEFT JOIN [Month Survey Active] ON [Month Structural
Active].[Proposed date By Month] = [Month Survey Active].[Proposed date By
Month];
It's getting closer. I have three queries which all request a date. When I
try to combine them into one query, it only asks for a date once - which is
what I want for the next step - the report.
The way it is configured now, however, I can only get the correct
information if there is any data in the Month Civil Active query. If there
happens to not be any data for February for Civil, the February info for
Structural and Survey will not show up.
I REALLY appreciate your help. Please don't give up on me yet . . .
Thanks