B
Brian
Having the old "Operation must use an updateable query" problem and not sure
why.
Query #1 (called DailyHeaderLookup)
SELECT FishCountsImport.ProjectID, FishCountsImport.ShiftDate
FROM FishCountsImport
GROUP BY FishCountsImport.ProjectID, FishCountsImport.ShiftDate;
I also tried:
SELECT DISTINCT FishCountsImport.ProjectID, FishCountsImport.ShiftDate
FROM FishCountsImport;
These both give me the same results: a single record for each
ProjectID/ShiftDate combination in FishCountsImport table.
Now, Query #2 (the one that is failing):
UPDATE DailyHeaderLookup INNER JOIN DailyHeader ON
(DailyHeaderLookup.ShiftDate = DailyHeader.ShiftDate) AND
(DailyHeaderLookup.ProjectID = DailyHeader.ProjectID) SET
DailyHeader.Status = "Updated";
Because the two field involved are together the primary key of the
DailyHeader table, and the DailyHeaderLookup is a SELECT DISTINCT or GROUP BY
on the same two fields, you can see that the relationship is one-to-one
between DailyHeaderLookup (query #1) & DailyHeader (the table I am attempting
to update)
Why is this not non-updateable? I know I can instead use DCount in a single
query, like this:
UPDATE DailyHeader SET DailyHeader.Status = "Updated"
WHERE (((DCount("*","[FishCountsImport]","[ProjectID] = " & [ProjectID] & "
and [ShiftDate] = #" & [ShiftDate] & "#"))>0));
I'm just trying to avoid introducting the domain aggregate into a query, but
is it the only way to get what I want?
why.
Query #1 (called DailyHeaderLookup)
SELECT FishCountsImport.ProjectID, FishCountsImport.ShiftDate
FROM FishCountsImport
GROUP BY FishCountsImport.ProjectID, FishCountsImport.ShiftDate;
I also tried:
SELECT DISTINCT FishCountsImport.ProjectID, FishCountsImport.ShiftDate
FROM FishCountsImport;
These both give me the same results: a single record for each
ProjectID/ShiftDate combination in FishCountsImport table.
Now, Query #2 (the one that is failing):
UPDATE DailyHeaderLookup INNER JOIN DailyHeader ON
(DailyHeaderLookup.ShiftDate = DailyHeader.ShiftDate) AND
(DailyHeaderLookup.ProjectID = DailyHeader.ProjectID) SET
DailyHeader.Status = "Updated";
Because the two field involved are together the primary key of the
DailyHeader table, and the DailyHeaderLookup is a SELECT DISTINCT or GROUP BY
on the same two fields, you can see that the relationship is one-to-one
between DailyHeaderLookup (query #1) & DailyHeader (the table I am attempting
to update)
Why is this not non-updateable? I know I can instead use DCount in a single
query, like this:
UPDATE DailyHeader SET DailyHeader.Status = "Updated"
WHERE (((DCount("*","[FishCountsImport]","[ProjectID] = " & [ProjectID] & "
and [ShiftDate] = #" & [ShiftDate] & "#"))>0));
I'm just trying to avoid introducting the domain aggregate into a query, but
is it the only way to get what I want?