deleting unmatched records

ion97

Registered User.
Local time
Today, 23:06
Joined
Feb 28, 2001
Messages
27
How can I do that?

I' ve tried to create a delete query, to delete all records which do not match records on another table (the first table looks up values from the second).

Although I've made the right selection (I get the records that I want to be deleted), when I try to run the query I get an error message "could not delete from specified table".

Does this mean that something is wrong with referential integrity
rules?

In any case how can I delete unmatched records?
 
Search the Queries Forum for "could not delete".
I'm sure you'll find your answer there.

RV
 
The way that I delete unmatched records is by doing the following.

1. Create a new text field in the table that you want to delete the unmatched records from. Call it "Flag".

2. Create an update query with the two tables concerned and make the join between the two tables. For the "Flag" field place "Matching Record".

3. Create a delete query which contains the table with the unmatched records and of course has the "Flag" field. In the criteria row of the query, place Is Null. These are the unmatched records. You can now delete these records.

Try this out on a separate db with dummy data to make sure you don't delete important data.

HTH

Aziz
 

Users who are viewing this thread

Back
Top Bottom