Delete multiple records from multiple tables in Access?

  • Thread starter Thread starter nalgene
  • Start date Start date
N

nalgene

I've look every else and can't find an answer, maybe someone on the board
can help me...

I am trying to create a query/expression/or macro to delete multiple records
from multiple tables.
I want the q/e/m to search all the secondary tables by a certain field and
delete all the records that do not have a corresponding value in the main
table field.

Example

Main Table
Field 1 (Not Primary Field); Record 1 - Value "A"
Record 2 - Value "B"
Record 3 - Value "F"

Secondary Table #1
Field 1 (Not Primary Field); Record 1 - Value "A"
Record 2 - Value "B"
Record 3 - Value "C'

Secondary Table #2
Field 1 (Not Primary Field); Record 1 - Value "B"
Record 2 - Value "D"
Record 3 - Value "E"

I want the q/e/m to delete Secondary Table #1 Record 3 and Secondary Table
#2 Records 2 and 3 because there are no corresponding values in the Main
Table.

Any help would be greatly appreciated
N
 
Use query wizard (unmatched records option) and save that query as a delete
query.
You'll need to have one query for each secondary table.
 
Thanks, worked just fine. It's funny how something hiding in plain view is
the hardest to find.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top