G
Guest
I've got a table (tblHouseholds) consisting of address information with an
additional field that stipulates the PrimaryMember (head of the household
from a related tblMembers table).
My problem is that as new records are added to tblHouseholds, PrimaryMember
is Null. I'm trying to figure out how to extract the MemberID of the first
record that was subsequently entered into tblMembers and insert it into
PrimaryMemberID.
I tried creating a qryFirstMembers query to bring the "Many" table down to
"1":
SELECT DISTINCT tblMembers.HouseholdID, First(tblMembers.MemberID) AS
FirstMemberID
FROM tblMembers
GROUP BY tblMembers.HouseholdID;
I then tried an update query by relating tblHouseholds to qryFirstMembers:
UPDATE tblHouseholds LEFT JOIN qryFirstMembers ON tblHouseholds.HouseholdID
= qryFirstMembers.HouseholdID SET tblHouseholds.PrimaryMember =
[FirstMemberID]
WHERE (((tblHouseholds.PrimaryMember) Is Null));
When I attempt to run the Update query, I'm challenged with a "Operation
must use an updatable query. (Error 3073)"
I can manually update PrimaryMember by hand but need to be able to update
records through a query or some other automated process.
Any ideas?
dbqph
additional field that stipulates the PrimaryMember (head of the household
from a related tblMembers table).
My problem is that as new records are added to tblHouseholds, PrimaryMember
is Null. I'm trying to figure out how to extract the MemberID of the first
record that was subsequently entered into tblMembers and insert it into
PrimaryMemberID.
I tried creating a qryFirstMembers query to bring the "Many" table down to
"1":
SELECT DISTINCT tblMembers.HouseholdID, First(tblMembers.MemberID) AS
FirstMemberID
FROM tblMembers
GROUP BY tblMembers.HouseholdID;
I then tried an update query by relating tblHouseholds to qryFirstMembers:
UPDATE tblHouseholds LEFT JOIN qryFirstMembers ON tblHouseholds.HouseholdID
= qryFirstMembers.HouseholdID SET tblHouseholds.PrimaryMember =
[FirstMemberID]
WHERE (((tblHouseholds.PrimaryMember) Is Null));
When I attempt to run the Update query, I'm challenged with a "Operation
must use an updatable query. (Error 3073)"
I can manually update PrimaryMember by hand but need to be able to update
records through a query or some other automated process.
Any ideas?
dbqph