473,800 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4498
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.itwr ote in message
news:11******** **************@ 16g2000cwy.goog legroups.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
3084
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 url that match 5 instances of url in the urls table. When I run the following I get a syntax error
1
5883
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 (several gigabytes a day) that the guy who set up the database creates a new table for it each day. His thinking was that if we only need to query one day's worth of data then it would be a lot faster to query a table with one day's data than having...
6
7347
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 from each other, but the actual fields of the data we need to move exist in both tables. From what I see in the MS Access help I can only find how to import a complete table from another Access database. How can I import the data from table...
1
1404
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 help....? Thanks Raj
8
10419
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 together. To make data entry easier I would like to combine selected columns from the four tables onto a single dataview that could be used as the datasource for a datagrid control. The distinct updates, insert ans delete
10
6864
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 at one point. I have two tables tblWorkers and tblLocations (locations & volunteer positions & start and end time using lookup wiz.) and made relationship using tblJunction. I need to build a form which shows volunteers details and a sub-form...
3
9923
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`. The 'product_ids` may be in one or more of these child tables but always in `products`. Is a single DELETE query possible that will delete all occurences of a `product_id` in the tables where the `product_id` occurs.
0
1524
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 like to have a query run and pull in all the products with their respective return. Is there a way to have it search for the same field on multiple sheets for example if you are looking for Product Sam, then it will check Return Sheet 1 2 or 3 to pull...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.