Hello, Access experts,
I have query "qryEmployeesB&N" (unique records, certain employees but not all)
ID LastName FirstName MName Suffix Department Group
and
table "tblActivities".
ID Date Activity
X 1/1/12 YYY
X 1/2/12 YYY
Y 1/1/12 YYY
I am working on a query that would give me name and group for every line in tblActivities.
The expected outcome is.
ID Date Activity LastName Group
X 1/1/12 YYY Smith B
X 1/2/12 YYY Smith B
Y 1/1/12 YYY Jones NB
Z 1/1/12 YYY 'This employee is not on my list
I am using a left outer join to link qryEmployeesB&N and tblActivities via ID because tblActivities has activities for all employees and I do not want to lose this data.
When there is no matching ID in qryEmployeesB&N (the activity is done by someone I am not interested in right now), I get:
- blank field for the name (which is logical for this join: no match - no name)
- BUT it puts "B" for the group (despite of the fact that this person is not on my list/query, and is not associated with group B or NB).
Why am I getting this "B" value when it is not supposed to be there?
Please advise.
I have query "qryEmployeesB&N" (unique records, certain employees but not all)
ID LastName FirstName MName Suffix Department Group
and
table "tblActivities".
ID Date Activity
X 1/1/12 YYY
X 1/2/12 YYY
Y 1/1/12 YYY
I am working on a query that would give me name and group for every line in tblActivities.
The expected outcome is.
ID Date Activity LastName Group
X 1/1/12 YYY Smith B
X 1/2/12 YYY Smith B
Y 1/1/12 YYY Jones NB
Z 1/1/12 YYY 'This employee is not on my list
I am using a left outer join to link qryEmployeesB&N and tblActivities via ID because tblActivities has activities for all employees and I do not want to lose this data.
When there is no matching ID in qryEmployeesB&N (the activity is done by someone I am not interested in right now), I get:
- blank field for the name (which is logical for this join: no match - no name)
- BUT it puts "B" for the group (despite of the fact that this person is not on my list/query, and is not associated with group B or NB).
Why am I getting this "B" value when it is not supposed to be there?
Please advise.
Code:
SELECT [tblActivities].[ID], [qryEmployeesB&NB].Group, [qryEmployeesB&NB].LastName
FROM tblActivities LEFT JOIN [qryEmployeesB&NB] ON [tblActivities].[ID] = [qryEmployeesB&NB].[ID#];
Last edited: