471,337 Members | 952 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Query to delete data in multiple tables

jpr
Hello,

My database has 5 tables.
WHen I add data to one table, it runs an append query that copies three
records to other 4 tables.

The main table is MASTER. The data I copy are: ID, SSN and PURGE DATE.

I would like to create a delete query that would delete all records in
all tables that show a date older that the one in the PURGE DATE. I use
a txtbox as criteria to my query.

My idea is to create a way to remove all records in all the tables at
the same time.
Thank you.

Dec 6 '06 #1
1 4288
Am I correct in understanding that you have a main Table, and there are four
Tables related to that table, and when you delete the Record in the main
table, you want to delete the related Records in the other four tables? If
so, create relationships between the main and each of the four Tables (on
the Database Window's menu, Tools | Relationships), set Referential
Integrity and Cascade Delete on the Relationships. Then, when you delete the
Record in the main Table, the related Records will automatically be deleted.

If I misunderstood what you have, please clarify.

Larry Linson
Microsoft Access MVP

"jpr" <jp***@tin.itwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Hello,

My database has 5 tables.
WHen I add data to one table, it runs an append query that copies three
records to other 4 tables.

The main table is MASTER. The data I copy are: ID, SSN and PURGE DATE.

I would like to create a delete query that would delete all records in
all tables that show a date older that the one in the PURGE DATE. I use
a txtbox as criteria to my query.

My idea is to create a way to remove all records in all the tables at
the same time.
Thank you.

Dec 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Craig Westerman | last post: by
1 post views Thread by wireless | last post: by
8 posts views Thread by Jason L James | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.