C
ChristopherK via AccessMonster.com
I have a table (tblBranches) of Company Branch Offices listing BranchID
(primary key) and several other branch particulars.
I have a second table (tblEmployees) of Employees at the entire company
listing EmployeeID (primary key) and other employee particulars. Employees
may work at multiple branches, so I have a third table (xtblBranchEmployees)
with no primary key that links the two tables above, so that I can pull all
the Employee Names at a particular branch or assign them to multiple branches.
For Example:
---tblBranches
BranchID BranchName BranchCity ...
1001 WestLock Harrisburg
1002 GalleriaMall York
...
---tblEmployees
EmployeeID EmployeeName EmployeeStatus ...
0001 Joe Smith A
0002 Mary West X
0003 Allen Wren A
0004 Sue Worthy B
...
---xtblBranchEmployees
BranchID EmployeeID
1001 0002
1001 0003
1001 0004
1002 0001
1002 0003
...
Indicating that Mary, Allen & Sue work at Branch 1001 and Joe & Allen work at
Branch 1002.
What I want to pull with a cross-tab query is the BranchID as the row heading
and the employees at that branch in columns based on the number of employees
present. Like this:
BranchID Employee1 Employee2 Employee3 ...
1001 Mary West Allen Wren Sue Worthy
1002 Joe Smith Allen Wren
Is this possible? Thank you.
(primary key) and several other branch particulars.
I have a second table (tblEmployees) of Employees at the entire company
listing EmployeeID (primary key) and other employee particulars. Employees
may work at multiple branches, so I have a third table (xtblBranchEmployees)
with no primary key that links the two tables above, so that I can pull all
the Employee Names at a particular branch or assign them to multiple branches.
For Example:
---tblBranches
BranchID BranchName BranchCity ...
1001 WestLock Harrisburg
1002 GalleriaMall York
...
---tblEmployees
EmployeeID EmployeeName EmployeeStatus ...
0001 Joe Smith A
0002 Mary West X
0003 Allen Wren A
0004 Sue Worthy B
...
---xtblBranchEmployees
BranchID EmployeeID
1001 0002
1001 0003
1001 0004
1002 0001
1002 0003
...
Indicating that Mary, Allen & Sue work at Branch 1001 and Joe & Allen work at
Branch 1002.
What I want to pull with a cross-tab query is the BranchID as the row heading
and the employees at that branch in columns based on the number of employees
present. Like this:
BranchID Employee1 Employee2 Employee3 ...
1001 Mary West Allen Wren Sue Worthy
1002 Joe Smith Allen Wren
Is this possible? Thank you.