Hi,
I have an append query that has to add a record to a table [Join_tbl] if the field [ReqUNID] does not exist (there are other fields added as well with their own criteria) OR If the [ReqUID] already exists but another field [TaskStatus] has changed, then overwrite the [TaskStatus] field only. This is the code I have that only adds a record if the [ReqUID] doesn't exist.
Thank you in advance for your help
I have an append query that has to add a record to a table [Join_tbl] if the field [ReqUNID] does not exist (there are other fields added as well with their own criteria) OR If the [ReqUID] already exists but another field [TaskStatus] has changed, then overwrite the [TaskStatus] field only. This is the code I have that only adds a record if the [ReqUID] doesn't exist.
Code:
INSERT INTO Join_tbl
( ReqUNID,
TaskTeam,
TaskAssignee,
taskStatus )
SELECT dbo_vwAssignments.ReqUNID,
dbo_vwAssignments.TaskTeam,
dbo_vwAssignments.TaskAssignee,
dbo_vwAssignments.taskStatus
FROM dbo_vwAssignments
WHERE (
((dbo_vwAssignments.TaskTeam)
="chp-vm")
AND ((dbo_vwAssignments.taskStatus)
="acknowledged"
Or (dbo_vwAssignments.taskStatus)
="new"
Or (dbo_vwAssignments.taskStatus)
="pending"
Or (dbo_vwAssignments.taskStatus) Is Null));
Comment