By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

Query to delete data in multiple tables

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.