473,225 Members | 1,298 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 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 4460
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Craig Westerman | last post by:
I'm trying to help a friend with this. When I run this everything is fine SELECT * from clicks, urls WHERE clicks.url=urls.url AND urls.description IS NULL The clicks table has 31 instances of...
1
by: wireless | last post by:
We recently added a new database at the company. It has only one purpose - to hold massive amounts a daily data generated by telephone calls on a network. The amount of data was so large...
6
by: Noozer | last post by:
We've created a new database and need to import the data from our old database. Both are MS Access databases and each have multiple tables. The table structure of each table is completely different...
1
by: Raj | last post by:
Hi I am trying to populate datagrid with a query which has multiple tables on it. It loads data fine but when I try to apply tablestylegrid and columnstyles its not taking it. Can anybody...
8
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
10
by: VirtualLilac | last post by:
Hi, Am trying to build a database for non-profit organisation, its a volunteer job and nobody around to guide me. From my learning I could able to build few reports and forms but am feeling stuck...
3
code green
by: code green | last post by:
I have a parent table `products` that contains all company products. The product details are divided amongst 4-5 product details child tables such as `paper`, `pens`, `books`, `sets`, `pens_paper`....
0
by: SamKhazary | last post by:
I have created a database that has a main table with a description of different products. I have 5 other data bases that are linked sheets that have returns for the 5 different prduct groups. I'd...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.