D
Darin
I have a table that I want to delete specific records from based on
data in other tables. I'm more familiar with Access '97, but am now
using 2003, but the database is in 2000 format. In '97, I think I
could have easily done this using joins, but I kept getting "could not
delete from specified tables" errors. Some google searching has
indicated I need to use a subquery. After many failed attempts with
different approaches, I finally did a couple of upstream queries to
give me the exast list of records I want to delete from the table, and
the output of that query only contains the four key fields of the table
I want to delete records from. Following is my query:
DELETE FROM FilterJobGroupTally
WHERE EXISTS
(SELECT *
FROM qryFilterDeleteLastPre
WHERE [FilterJobGroupTally].[JobID] = [qryFilterDeleteLastPre].[JobID]
AND [FilterJobGroupTally].[FilterJobGroupID] =
[qryFilterDeleteLastPre].[FilterJobGroupID] AND
[FilterJobGroupTally].[FilterTypeID] =
[qryFilterDeleteLastPre].[FilterTypeID] AND
[FilterJobGroupTally].[FilterSizeID] =
[qryFilterDeleteLastPre].[FilterSizeID]);
When I run this, it tries to delete ALL the records in
FilterJobGroupTally, not just the ones that exist in the subquery
qryFilterDeleteLastPre. What am I doing wrong?
Thanks!
data in other tables. I'm more familiar with Access '97, but am now
using 2003, but the database is in 2000 format. In '97, I think I
could have easily done this using joins, but I kept getting "could not
delete from specified tables" errors. Some google searching has
indicated I need to use a subquery. After many failed attempts with
different approaches, I finally did a couple of upstream queries to
give me the exast list of records I want to delete from the table, and
the output of that query only contains the four key fields of the table
I want to delete records from. Following is my query:
DELETE FROM FilterJobGroupTally
WHERE EXISTS
(SELECT *
FROM qryFilterDeleteLastPre
WHERE [FilterJobGroupTally].[JobID] = [qryFilterDeleteLastPre].[JobID]
AND [FilterJobGroupTally].[FilterJobGroupID] =
[qryFilterDeleteLastPre].[FilterJobGroupID] AND
[FilterJobGroupTally].[FilterTypeID] =
[qryFilterDeleteLastPre].[FilterTypeID] AND
[FilterJobGroupTally].[FilterSizeID] =
[qryFilterDeleteLastPre].[FilterSizeID]);
When I run this, it tries to delete ALL the records in
FilterJobGroupTally, not just the ones that exist in the subquery
qryFilterDeleteLastPre. What am I doing wrong?
Thanks!