Deirdre Marie
Access in Excess
- Local time
- Today, 17:11
- Joined
- Sep 17, 2001
- Messages
- 34
I am using a linked table from another database and a "local" table to compare data. The linked table always has the correct information so I am utilizing append and delete queries to ensure my local one stays up to date as well.
These tables record upcoming community type events. The linked table automatically assigns a number to the event and I use that number to compare the two tables. If a number exists in my local table but not the linked, it's deleted. If a number does not exist in my local, but does exist in the linked, it's added.
Easy!
However, I've now discovered a problem in that sometimes information is changed within the event and the append /delete queries need to be re-written in order to catch this.
Original Information
ID Date Event
100 2/1/03 Firehouse Carnival
New Information
ID Date Event
100 2/9/03 Firehouse Carnival
As written, the append and delete queries wind up keeping both as the ID Number has not changed. I deceided to edit the original SQL so it will look at the ID AND the date and delete anyhting from my local table that does not match the linked table. Unfortunately, it is not working, and I need a little assistance.
DELETE Projections.*, ProdPlan.ID, ProdPlan.ID, ProdPlan.DATE
FROM Projections LEFT JOIN ProdPlan ON Projections.ID = ProdPlan.ID
WHERE (((ProdPlan.ID) Is Null)) OR (((ProdPlan.ID)<>[Projections].[ID]) AND ((ProdPlan.DATE)<>[Projections].[DATE]));
Thank you in advanced!
These tables record upcoming community type events. The linked table automatically assigns a number to the event and I use that number to compare the two tables. If a number exists in my local table but not the linked, it's deleted. If a number does not exist in my local, but does exist in the linked, it's added.
Easy!
However, I've now discovered a problem in that sometimes information is changed within the event and the append /delete queries need to be re-written in order to catch this.
Original Information
ID Date Event
100 2/1/03 Firehouse Carnival
New Information
ID Date Event
100 2/9/03 Firehouse Carnival
As written, the append and delete queries wind up keeping both as the ID Number has not changed. I deceided to edit the original SQL so it will look at the ID AND the date and delete anyhting from my local table that does not match the linked table. Unfortunately, it is not working, and I need a little assistance.
DELETE Projections.*, ProdPlan.ID, ProdPlan.ID, ProdPlan.DATE
FROM Projections LEFT JOIN ProdPlan ON Projections.ID = ProdPlan.ID
WHERE (((ProdPlan.ID) Is Null)) OR (((ProdPlan.ID)<>[Projections].[ID]) AND ((ProdPlan.DATE)<>[Projections].[DATE]));
Thank you in advanced!