G
Guest
I am using Office Access 2003. I am having a problem when the final Query C
below displays no data when one of the subqueries have no results. Issue: I
have 143 individuals that completed a survey in the database. For Question 4
of the survey, an individual can choose either: none, some or all of the 7
responses, by checking Yes to a “Yes/No†formatted field in each of the 7
fields. Of these 7 individual responses, I want the Count of only the Yes
responses. Query A below “qryQ4 Purpose†is the initial query. Subquery B
is the sample of the first field [Q4TV] in which 62 individuals responded
“Yes†to [Q4TV]. No problem. I have used the same format for each of the 7
fields; only the Yes responses. [Q4TV] through [Q4O]. However, for one of
the fields, no-one has chosen any Yes responses to [Q4R]. So, all 143
individuals indicated No. If this happens, I want the subquery to give me a
0 (zero) result; however the subquery gives me no results. Thus for the
summary SubQuery D below, when I select all the [CountOf…] fields for each of
the 7 separate subqueries into 1 Query, the end result provides no result,
because just one of those subqueries has a null answer. I have several
Questions in the survey that will have this same situation. My question, how
do I build the subqueries to provide a 0 when no Yes responses are found?
Query A: “qryQ4 Purposeâ€
SELECT [tblTHistory A Q1 Q9].[THQID#], [tblTHistory A Q1 Q9].Q4TV,
[tblTHistory A Q1 Q9].Q4WD, [tblTHistory A Q1 Q9].Q4VF, [tblTHistory A Q1
Q9].Q4MV, [tblTHistory A Q1 Q9].Q4R, [tblTHistory A Q1 Q9].Q4RE, [tblTHistory
A Q1 Q9].Q4O, FROM [tblTHistory A Q1 Q9];
Subquery B: “qryQ4 Purpose 1TVâ€
SELECT [qryQ4 Purpose].Q4TV, Count([qryQ4 Purpose].Q4TV) AS CountOfQ4TV
FROM [qryQ4 Purpose]
GROUP BY [qryQ4 Purpose].Q4TV
HAVING ((([qryQ4 Purpose].Q4TV)=Yes));
SubQuery C: “qryQ4 Purpose Summaryâ€
SELECT [qryQ0 Count of Surveys].[CountOfTHQID#], [qryQ4 Purpose
1TV].CountOfQ4TV, [qryQ4 Purpose 2WD].CountOfQ4WD, [qryQ4 Purpose
3VF].CountOfQ4VF, [qryQ4 Purpose 4MV].CountOfQ4MV, [qryQ4 Purpose
5R].CountOfQ4R, [qryQ4 Purpose 6RE].CountOfQ4RE, [qryQ4 Purpose 7O].CountOfQ4O
FROM [qryQ4 Purpose 1TV], [qryQ4 Purpose 2WD], [qryQ4 Purpose 3VF], [qryQ4
Purpose 4MV], [qryQ4 Purpose 5R], [qryQ4 Purpose 6RE], [qryQ4 Purpose 7O],
[qryQ0 Count of Surveys];
Your help would be greatly appreciated. Thank you. Curtis…..
below displays no data when one of the subqueries have no results. Issue: I
have 143 individuals that completed a survey in the database. For Question 4
of the survey, an individual can choose either: none, some or all of the 7
responses, by checking Yes to a “Yes/No†formatted field in each of the 7
fields. Of these 7 individual responses, I want the Count of only the Yes
responses. Query A below “qryQ4 Purpose†is the initial query. Subquery B
is the sample of the first field [Q4TV] in which 62 individuals responded
“Yes†to [Q4TV]. No problem. I have used the same format for each of the 7
fields; only the Yes responses. [Q4TV] through [Q4O]. However, for one of
the fields, no-one has chosen any Yes responses to [Q4R]. So, all 143
individuals indicated No. If this happens, I want the subquery to give me a
0 (zero) result; however the subquery gives me no results. Thus for the
summary SubQuery D below, when I select all the [CountOf…] fields for each of
the 7 separate subqueries into 1 Query, the end result provides no result,
because just one of those subqueries has a null answer. I have several
Questions in the survey that will have this same situation. My question, how
do I build the subqueries to provide a 0 when no Yes responses are found?
Query A: “qryQ4 Purposeâ€
SELECT [tblTHistory A Q1 Q9].[THQID#], [tblTHistory A Q1 Q9].Q4TV,
[tblTHistory A Q1 Q9].Q4WD, [tblTHistory A Q1 Q9].Q4VF, [tblTHistory A Q1
Q9].Q4MV, [tblTHistory A Q1 Q9].Q4R, [tblTHistory A Q1 Q9].Q4RE, [tblTHistory
A Q1 Q9].Q4O, FROM [tblTHistory A Q1 Q9];
Subquery B: “qryQ4 Purpose 1TVâ€
SELECT [qryQ4 Purpose].Q4TV, Count([qryQ4 Purpose].Q4TV) AS CountOfQ4TV
FROM [qryQ4 Purpose]
GROUP BY [qryQ4 Purpose].Q4TV
HAVING ((([qryQ4 Purpose].Q4TV)=Yes));
SubQuery C: “qryQ4 Purpose Summaryâ€
SELECT [qryQ0 Count of Surveys].[CountOfTHQID#], [qryQ4 Purpose
1TV].CountOfQ4TV, [qryQ4 Purpose 2WD].CountOfQ4WD, [qryQ4 Purpose
3VF].CountOfQ4VF, [qryQ4 Purpose 4MV].CountOfQ4MV, [qryQ4 Purpose
5R].CountOfQ4R, [qryQ4 Purpose 6RE].CountOfQ4RE, [qryQ4 Purpose 7O].CountOfQ4O
FROM [qryQ4 Purpose 1TV], [qryQ4 Purpose 2WD], [qryQ4 Purpose 3VF], [qryQ4
Purpose 4MV], [qryQ4 Purpose 5R], [qryQ4 Purpose 6RE], [qryQ4 Purpose 7O],
[qryQ0 Count of Surveys];
Your help would be greatly appreciated. Thank you. Curtis…..