queries troubleshooting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a query

SELECT Month.Nominative, Target.TargetLife, Target.TargetGeneral
FROM [Month] LEFT JOIN Target ON Month.MonthID = Target.Month
WHERE (((Target.Year)=[Forms]![InsurerSelection]![SystemYear]) AND
((Target.InsurerID)=[Forms]![InsurerSelection]![ListInsurerSelection]))
ORDER BY Month.MonthID;

but it doesn't return all records from Month table.
If i create a query with name query2 filtering records from table Target

SELECT Target.InsurerID, Target.Year, Target.Month, Target.TargetLife,
Target.TargetGeneral
FROM Target
WHERE
(((Target.InsurerID)=[Forms]![InsurerSelection]![ListInsurerSelection]) AND
((Target.Year)=[Forms]![InsurerSelection]![SystemYear]));

and then i create another one query which "uses" query2

SELECT Month.Nominative, query2.TargetLife, query2.TargetGeneral
FROM [Month] LEFT JOIN query2 ON Month.MonthID = query2.Month
ORDER BY Month.MonthID;

the last one query will return all records! Is it possible to do that with
one query?
 
?????? ???????????? said:
I have created a query

SELECT Month.Nominative, Target.TargetLife, Target.TargetGeneral
FROM [Month] LEFT JOIN Target ON Month.MonthID = Target.Month
WHERE (((Target.Year)=[Forms]![InsurerSelection]![SystemYear]) AND
((Target.InsurerID)=[Forms]![InsurerSelection]![ListInsurerSelection]))
ORDER BY Month.MonthID;

but it doesn't return all records from Month table.
If i create a query with name query2 filtering records from table Target

SELECT Target.InsurerID, Target.Year, Target.Month, Target.TargetLife,
Target.TargetGeneral
FROM Target
WHERE
(((Target.InsurerID)=[Forms]![InsurerSelection]![ListInsurerSelection]) AND
((Target.Year)=[Forms]![InsurerSelection]![SystemYear]));

and then i create another one query which "uses" query2

SELECT Month.Nominative, query2.TargetLife, query2.TargetGeneral
FROM [Month] LEFT JOIN query2 ON Month.MonthID = query2.Month
ORDER BY Month.MonthID;

the last one query will return all records! Is it possible to do that with
one query?

SELECT Month.Nominative, Target.TargetLife, Target.TargetGeneral
FROM [Month] LEFT JOIN Target ON (Month.MonthID = Target.Month
AND (((Target.Year)=[Forms]![InsurerSelection]![SystemYear]) AND
((Target.InsurerID)=[Forms]![InsurerSelection]![ListInsurerSelection])))
ORDER BY Month.MonthID;
 
Back
Top