G
Guest
I have a lookup table which contains 4 options(L_tblCode). I need all 4 of
these options to show after I run a query from my main
table(qryfilter_Data_Entry_3_Months). Currently, this does not happen
because the query is filtered by a 3 month date range. Those 4 options
exist, but not always within that 3 month date range. How can I force all
the options to show even if they do not exist in that 3 month date range?
My current query:
PARAMETERS [Enter the Area] Text ( 255 ), [Enter the Code] Text ( 255 );
SELECT Format([L_Date],"m") AS Expr2,
qryreport_Dept_Total_EOM_3_Months.Expr1 AS Expr1, L_tblArea_Tech.L_Area AS
Dept, L_tblCode.L_Code AS Code,
Nz(Count(qryfilter_No_OTHR.Code),0)-Nz(Count(tblFail.Code),0)+Nz(Sum([Kits_Failed]),0)
AS [Code Fails], qryreport_Dept_Total_EOM_3_Months.Fails AS Total, [Code
Fails]/[Total] AS [%]
FROM (((qryfilter_Data_Entry_3_Months LEFT JOIN (qryfilter_No_OTHR LEFT JOIN
L_tblCode ON qryfilter_No_OTHR.Code = L_tblCode.L_Code_ID) ON
qryfilter_Data_Entry_3_Months.tblData_Entry_ID =
qryfilter_No_OTHR.tblData_Entry_ID) LEFT JOIN (tblKits LEFT JOIN tblFail ON
tblKits.tblData_Entry_ID = tblFail.tblData_Entry_ID) ON
qryfilter_Data_Entry_3_Months.tblData_Entry_ID = tblKits.tblData_Entry_ID)
LEFT JOIN L_tblArea_Tech ON qryfilter_Data_Entry_3_Months.Tech =
L_tblArea_Tech.L_Area_Tech_ID) LEFT JOIN qryreport_Dept_Total_EOM_3_Months ON
L_tblArea_Tech.L_Area = qryreport_Dept_Total_EOM_3_Months.Dept
GROUP BY Format([L_Date],"m"), qryreport_Dept_Total_EOM_3_Months.Expr1,
L_tblArea_Tech.L_Area, L_tblCode.L_Code,
qryreport_Dept_Total_EOM_3_Months.Fails
HAVING (((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m")) AND
((L_tblArea_Tech.L_Area)=[Enter the Area]) AND ((L_tblCode.L_Code)=[Enter the
Code])) OR (((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m"))
AND ((L_tblArea_Tech.L_Area) Is Not Null) AND ((L_tblCode.L_Code)=[Enter the
Code]) AND ((([L_tblArea_Tech].[L_Area]) Like [Enter the Area]) Is Null)) OR
(((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m")) AND
((L_tblArea_Tech.L_Area)=[Enter the Area]) AND ((L_tblCode.L_Code) Is Not
Null) AND ((([L_tblCode].[L_Code]) Like [Enter the Code]) Is Null)) OR
(((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m")) AND
((L_tblArea_Tech.L_Area) Is Not Null) AND ((L_tblCode.L_Code) Is Not Null)
AND ((([L_tblArea_Tech].[L_Area]) Like [Enter the Area]) Is Null) AND
((([L_tblCode].[L_Code]) Like [Enter the Code]) Is Null))
ORDER BY Format([L_Date],"m"), qryreport_Dept_Total_EOM_3_Months.Expr1,
L_tblArea_Tech.L_Area, L_tblCode.L_Code;
these options to show after I run a query from my main
table(qryfilter_Data_Entry_3_Months). Currently, this does not happen
because the query is filtered by a 3 month date range. Those 4 options
exist, but not always within that 3 month date range. How can I force all
the options to show even if they do not exist in that 3 month date range?
My current query:
PARAMETERS [Enter the Area] Text ( 255 ), [Enter the Code] Text ( 255 );
SELECT Format([L_Date],"m") AS Expr2,
qryreport_Dept_Total_EOM_3_Months.Expr1 AS Expr1, L_tblArea_Tech.L_Area AS
Dept, L_tblCode.L_Code AS Code,
Nz(Count(qryfilter_No_OTHR.Code),0)-Nz(Count(tblFail.Code),0)+Nz(Sum([Kits_Failed]),0)
AS [Code Fails], qryreport_Dept_Total_EOM_3_Months.Fails AS Total, [Code
Fails]/[Total] AS [%]
FROM (((qryfilter_Data_Entry_3_Months LEFT JOIN (qryfilter_No_OTHR LEFT JOIN
L_tblCode ON qryfilter_No_OTHR.Code = L_tblCode.L_Code_ID) ON
qryfilter_Data_Entry_3_Months.tblData_Entry_ID =
qryfilter_No_OTHR.tblData_Entry_ID) LEFT JOIN (tblKits LEFT JOIN tblFail ON
tblKits.tblData_Entry_ID = tblFail.tblData_Entry_ID) ON
qryfilter_Data_Entry_3_Months.tblData_Entry_ID = tblKits.tblData_Entry_ID)
LEFT JOIN L_tblArea_Tech ON qryfilter_Data_Entry_3_Months.Tech =
L_tblArea_Tech.L_Area_Tech_ID) LEFT JOIN qryreport_Dept_Total_EOM_3_Months ON
L_tblArea_Tech.L_Area = qryreport_Dept_Total_EOM_3_Months.Dept
GROUP BY Format([L_Date],"m"), qryreport_Dept_Total_EOM_3_Months.Expr1,
L_tblArea_Tech.L_Area, L_tblCode.L_Code,
qryreport_Dept_Total_EOM_3_Months.Fails
HAVING (((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m")) AND
((L_tblArea_Tech.L_Area)=[Enter the Area]) AND ((L_tblCode.L_Code)=[Enter the
Code])) OR (((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m"))
AND ((L_tblArea_Tech.L_Area) Is Not Null) AND ((L_tblCode.L_Code)=[Enter the
Code]) AND ((([L_tblArea_Tech].[L_Area]) Like [Enter the Area]) Is Null)) OR
(((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m")) AND
((L_tblArea_Tech.L_Area)=[Enter the Area]) AND ((L_tblCode.L_Code) Is Not
Null) AND ((([L_tblCode].[L_Code]) Like [Enter the Code]) Is Null)) OR
(((qryreport_Dept_Total_EOM_3_Months.Expr1)=Format([L_Date],"m")) AND
((L_tblArea_Tech.L_Area) Is Not Null) AND ((L_tblCode.L_Code) Is Not Null)
AND ((([L_tblArea_Tech].[L_Area]) Like [Enter the Area]) Is Null) AND
((([L_tblCode].[L_Code]) Like [Enter the Code]) Is Null))
ORDER BY Format([L_Date],"m"), qryreport_Dept_Total_EOM_3_Months.Expr1,
L_tblArea_Tech.L_Area, L_tblCode.L_Code;