473,830 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which table's records get deleted?

MLH
I have two tables with a common field containing
an automobile VIN code. If I create a query putting
both tables in the QBE grid and link the common
field between the two tables and drop one single
field from one ofthe tables for display purposes,
I get a list of records having common values in
both tables.

If I select all rows in the dynaset and press delete
key - records from the same table each time are
deleted. I wanted them to be deleted from the
other table (of course).

How do I control that?

PVIN and SerialNum are the common fields in the
two tables.

SELECT tblPreliminaryV INs.PVIN FROM tblPreliminaryV INs INNER JOIN
tblVehicleJobs ON tblPreliminaryV INs.PVIN = tblVehicleJobs. SerialNum;

Aug 22 '06 #1
3 2627
MLH
I forgot to mention that if you dbl-click the join in the QBE grid
(between the two tables) the join type is 1...

Only include rows where the joined fields from both tables are equal.

Also, I wanted to ask - since it doesn't matter which table's fields
are brought down for display, when you "select all records" and
press the delete key, Access just decides which table it wants to
delete from and does it. It doesn't delete from both tables. It only
deletes from one and its always the same one in my tests. How
does Access choose which one it wants to delete?
Aug 22 '06 #2
MLH
One more thing worthy of note is that I get an error
telling me "couldn't delete from specified tables" if
I run this delete query...

DELETE tblPreliminaryV INs.* FROM tblPreliminaryV INs INNER JOIN
tblVehicleJobs ON tblPreliminaryV INs.PVIN = tblVehicleJobs. SerialNum;

Access HELP had this to say, but none of it is applicable AFAIK...
Couldn't delete from specified tables. (Error 3086)
You tried to delete data from one or more tables, but the deletion
couldn't be completed.
Possible causes:

You don't have permission to modify the table. To change your
permissions assignments, see your system administrator or the table's
creator.
The database was opened for read-only access. The database is
read-only for one of these reasons:

You used the OpenDatabase method and opened the database for read-only
access.
The database file is defined as read-only in the database server
operating system or by your network.
In a network environment, you don't have write privileges for the
database file.
In Visual Basic, you used the Data control and set the ReadOnly
property to True.

To delete the data, close the database, resolve the read-only
condition, and then reopen the file for read/write access.
Aug 22 '06 #3
select queries and delete queries are different beasts.

use a subselect if you want to have control over which records get
deleted. Instead of using an inner join to the table you want to
specify the criteria, do something like

DELETE
FROM tblDeleteFromHE RE
WHERE tblDeleteFromHe re.PrimaryKey IN (SELECT PrimaryKey FROM SomeTable
WHERE....)

Aug 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3110
by: Paul T. Rong | last post by:
Dear all, Here is my problem: There is a table "products" in my access database, since some of the products are out of date and stopped manufacture, I would like to delete those PRODUCTS from the table, but I was not allowed to do that, because "there are records related with those PRODUCTS in other tables (e.g. in table "ORDER_DETAIL").
1
1988
by: KC | last post by:
I am using Access 2002, with a database template from MS Office. The Orders Management Database. I have tweaked this for use with our company. It is a small database with close to a 1000 records in our Orders table. Within this table are 80 records that I decided to delete to clean it up a bit. When I went into my data entry form, I noticed the bottom portion of the form was blank, this is usually the area that contains each customers...
2
8852
by: Cornelius Buschka | last post by:
Hi, we saw the following problem: We deleted all rows from a table B referencing table A (~500000 records). No problem, but the following try to delete all records from table A (~180000) lead to a "never ending" statement. We found out, that vacuuming table B after delete did the trick. It seems to us the database has to do scan thru deleted records on B while
3
2330
by: BrianDP | last post by:
I have a database with a split front end/back end. There is a key table in the back end called Catalog, and it is sort of a central key table for all sorts of things. It's a list of all the jobs that have ever been worked on at our company. Records are getting lost out of this table, but I have no way of figuring out how they're being deleted. Records should NEVER be deleted out of this table. They can be marked as inactive, or...
2
1305
by: MLH | last post by:
I had a table (tblReturnReceipts) with 47 records and I wanted 18 of its records deleted. So I thought I would be smart and make another table (a temporary junk table) named BadRRIDs and use it in the following Select query... SELECT tblReturnReceipts.RtnRcptID, tblReturnReceipts.CorrespID, tblReturnReceipts.DateSigned, tblReturnReceipts.OLA, tblReturnReceipts.OLA_ID, tblReturnReceipts.RRTDstamp, tblReturnReceipts.RRuser,...
9
6956
by: Oonz | last post by:
Hi Friends, How can we insert records in sorted order like consider a table No Name Phone 1 test1 12345 1 test1 23455 2 test2 68638
3
4838
by: Shestine | last post by:
I am trying to add a column to a current table, with data in it. I am only learning, and i have no idea how to change this to make it work. Here is the script I have right now it, but what it does is delete the whole table and recreates it, adding in the extra column. I don't want that. I want the data that is currently there to stay there and then add anew column. How do I reword this (If possible) to make it work? if exists (select * from...
1
3947
by: musicloverlch | last post by:
I have a DB2 table and when I open it, all the records show up as #Deleted. I went here: http://www.techonthenet.com/access/tables/del_err_linked.php and tried this, but I don't get a pop-up box to choose any primary keys. The kicker is that the table works fine in Crystal Reports. What is wrong with Access? Why doesn't it work? Thanks in advance, Laura
1
212
by: MLH | last post by:
Put 2 tables in a qbe grid & link 'em so as to list only records in tblA that have related records in tblB. Run the query. HiLite a row. Press delete key. A record is deleted. How can you design the query so that you KNOW in advance which table a record will be deleted from.
0
9781
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
9641
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
10477
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7740
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6944
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
5777
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4408
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3956
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.