R
Robin
THIS IS PROBABLY TOO MUCH TO ASK BUT: I'm trying to design a query to view
data and be able to edit that data. I know there are restrictions on that,
but I need to design this so as to not violate those restrictions. I have
two tables ClientAssignment and Staff. The ClientAssignment table uses four
fields as the Primary Key (ClientID, EngagementID, EngagementYr,
AssignmentID) and a field to link to the Staff table (CAStaffID). The Staff
table uses StaffID as the Primary Key.
Basicallly I'm trying to make a datasheet "read across" by Assignment ID so
that the PREP BillRate x BudgetHrs + REV1 BillRate x BudgetHrs + REV2
BillRate x BudgetHrs = Total Budget across 1 line for each Client Engagement.
I've written the query two different ways but neither work.
First attempt which shows me the data as I like but is not updatable:
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([ClientAssignment.CABudgetHrs]*[Staff.BillRate]) AS Expr1,
ClientAssignment_1.AssignmentID, ClientAssignment_1.CAStaffID,
ClientAssignment_1.CABudgetHrs, Staff_1.BillRate,
CCur([ClientAssignment_1.CABudgetHrs]*[Staff_1.BillRate]) AS Expr2,
ClientAssignment_2.AssignmentID, ClientAssignment_2.CAStaffID,
ClientAssignment_2.CABudgetHrs, Staff_2.BillRate,
CCur([ClientAssignment_2.CABudgetHrs]*[Staff_2.BillRate]) AS Expr3,
CCur([Expr1]+[Expr2]+[Expr3]) AS Expr4
FROM ((Staff INNER JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID) INNER JOIN (ClientAssignment AS
ClientAssignment_1 INNER JOIN Staff AS Staff_1 ON
ClientAssignment_1.CAStaffID = Staff_1.StaffID) ON
(ClientAssignment.EngagementYr = ClientAssignment_1.EngagementYr) AND
(ClientAssignment.EngagementID = ClientAssignment_1.EngagementID) AND
(ClientAssignment.ClientID = ClientAssignment_1.ClientID)) INNER JOIN
(ClientAssignment AS ClientAssignment_2 INNER JOIN Staff AS Staff_2 ON
ClientAssignment_2.CAStaffID = Staff_2.StaffID) ON
(ClientAssignment.EngagementYr = ClientAssignment_2.EngagementYr) AND
(ClientAssignment.EngagementID = ClientAssignment_2.EngagementID) AND
(ClientAssignment.ClientID = ClientAssignment_2.ClientID)
WHERE (((ClientAssignment.AssignmentID)="PREP") AND
((ClientAssignment_1.AssignmentID)="REV1") AND
((ClientAssignment_2.AssignmentID)="REV2"));
The second attempt, I tried doing three separate queries and then using them
in the "top query". EACH INDIVIDUAL QUERY ALLOWS UPDATES but when I use more
than one in the "top" query, it becomes un-updatable.
I have three queries (qBudgetWSa, b, c) with this design:
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([CABudgetHrs]*[BillRate]) AS Expr1
FROM Staff RIGHT JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID
WHERE (((ClientAssignment.AssignmentID)="PREP"));
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([CABudgetHrs]*[BillRate]) AS Expr1
FROM Staff RIGHT JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID
WHERE (((ClientAssignment.AssignmentID)="REV1"));
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([CABudgetHrs]*[BillRate]) AS Expr1
FROM Staff RIGHT JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID
WHERE (((ClientAssignment.AssignmentID)="REV2"));
But when I JOIN any two of them (and I've tried EVERY combination of JOIN)
it no longer is updatable.
SELECT qBudgetWSa.ClientID, qBudgetWSa.EngagementID,
qBudgetWSa.EngagementYr, qBudgetWSa.AssignmentID, qBudgetWSa.CAStaffID,
qBudgetWSa.CABudgetHrs, qBudgetWSa.BillRate, qBudgetWSa.Expr1,
qBudgetWSb.AssignmentID, qBudgetWSb.CAStaffID, qBudgetWSb.CABudgetHrs,
qBudgetWSb.BillRate, qBudgetWSb.Expr1
FROM (qBudgetWSa INNER JOIN qBudgetWSb ON (qBudgetWSa.EngagementYr =
qBudgetWSb.EngagementYr) AND (qBudgetWSa.EngagementID =
qBudgetWSb.EngagementID) AND (qBudgetWSa.ClientID = qBudgetWSb.ClientID))
INNER JOIN qBudgetWSc ON (qBudgetWSa.EngagementYr = qBudgetWSc.EngagementYr)
AND (qBudgetWSa.EngagementID = qBudgetWSc.EngagementID) AND
(qBudgetWSa.ClientID = qBudgetWSc.ClientID);
Whew! Can this even be accomplished?
Thanks
Robin
data and be able to edit that data. I know there are restrictions on that,
but I need to design this so as to not violate those restrictions. I have
two tables ClientAssignment and Staff. The ClientAssignment table uses four
fields as the Primary Key (ClientID, EngagementID, EngagementYr,
AssignmentID) and a field to link to the Staff table (CAStaffID). The Staff
table uses StaffID as the Primary Key.
Basicallly I'm trying to make a datasheet "read across" by Assignment ID so
that the PREP BillRate x BudgetHrs + REV1 BillRate x BudgetHrs + REV2
BillRate x BudgetHrs = Total Budget across 1 line for each Client Engagement.
I've written the query two different ways but neither work.
First attempt which shows me the data as I like but is not updatable:
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([ClientAssignment.CABudgetHrs]*[Staff.BillRate]) AS Expr1,
ClientAssignment_1.AssignmentID, ClientAssignment_1.CAStaffID,
ClientAssignment_1.CABudgetHrs, Staff_1.BillRate,
CCur([ClientAssignment_1.CABudgetHrs]*[Staff_1.BillRate]) AS Expr2,
ClientAssignment_2.AssignmentID, ClientAssignment_2.CAStaffID,
ClientAssignment_2.CABudgetHrs, Staff_2.BillRate,
CCur([ClientAssignment_2.CABudgetHrs]*[Staff_2.BillRate]) AS Expr3,
CCur([Expr1]+[Expr2]+[Expr3]) AS Expr4
FROM ((Staff INNER JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID) INNER JOIN (ClientAssignment AS
ClientAssignment_1 INNER JOIN Staff AS Staff_1 ON
ClientAssignment_1.CAStaffID = Staff_1.StaffID) ON
(ClientAssignment.EngagementYr = ClientAssignment_1.EngagementYr) AND
(ClientAssignment.EngagementID = ClientAssignment_1.EngagementID) AND
(ClientAssignment.ClientID = ClientAssignment_1.ClientID)) INNER JOIN
(ClientAssignment AS ClientAssignment_2 INNER JOIN Staff AS Staff_2 ON
ClientAssignment_2.CAStaffID = Staff_2.StaffID) ON
(ClientAssignment.EngagementYr = ClientAssignment_2.EngagementYr) AND
(ClientAssignment.EngagementID = ClientAssignment_2.EngagementID) AND
(ClientAssignment.ClientID = ClientAssignment_2.ClientID)
WHERE (((ClientAssignment.AssignmentID)="PREP") AND
((ClientAssignment_1.AssignmentID)="REV1") AND
((ClientAssignment_2.AssignmentID)="REV2"));
The second attempt, I tried doing three separate queries and then using them
in the "top query". EACH INDIVIDUAL QUERY ALLOWS UPDATES but when I use more
than one in the "top" query, it becomes un-updatable.
I have three queries (qBudgetWSa, b, c) with this design:
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([CABudgetHrs]*[BillRate]) AS Expr1
FROM Staff RIGHT JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID
WHERE (((ClientAssignment.AssignmentID)="PREP"));
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([CABudgetHrs]*[BillRate]) AS Expr1
FROM Staff RIGHT JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID
WHERE (((ClientAssignment.AssignmentID)="REV1"));
SELECT ClientAssignment.ClientID, ClientAssignment.EngagementID,
ClientAssignment.EngagementYr, ClientAssignment.AssignmentID,
ClientAssignment.CAStaffID, ClientAssignment.CABudgetHrs, Staff.BillRate,
CCur([CABudgetHrs]*[BillRate]) AS Expr1
FROM Staff RIGHT JOIN ClientAssignment ON Staff.StaffID =
ClientAssignment.CAStaffID
WHERE (((ClientAssignment.AssignmentID)="REV2"));
But when I JOIN any two of them (and I've tried EVERY combination of JOIN)
it no longer is updatable.
SELECT qBudgetWSa.ClientID, qBudgetWSa.EngagementID,
qBudgetWSa.EngagementYr, qBudgetWSa.AssignmentID, qBudgetWSa.CAStaffID,
qBudgetWSa.CABudgetHrs, qBudgetWSa.BillRate, qBudgetWSa.Expr1,
qBudgetWSb.AssignmentID, qBudgetWSb.CAStaffID, qBudgetWSb.CABudgetHrs,
qBudgetWSb.BillRate, qBudgetWSb.Expr1
FROM (qBudgetWSa INNER JOIN qBudgetWSb ON (qBudgetWSa.EngagementYr =
qBudgetWSb.EngagementYr) AND (qBudgetWSa.EngagementID =
qBudgetWSb.EngagementID) AND (qBudgetWSa.ClientID = qBudgetWSb.ClientID))
INNER JOIN qBudgetWSc ON (qBudgetWSa.EngagementYr = qBudgetWSc.EngagementYr)
AND (qBudgetWSa.EngagementID = qBudgetWSc.EngagementID) AND
(qBudgetWSa.ClientID = qBudgetWSc.ClientID);
Whew! Can this even be accomplished?
Thanks
Robin