473,498 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error 3086

2 New Member
I'm an IT student currently working on a database and I am required to perform a delete query. The database I am working on seems simple enough but the query simly wont run.

This is my SQL:

DELETE Payments.*, Sections.*, [Personal Information].*, [Personal Information].[ID Number]
FROM [Personal Information] INNER JOIN (Sections INNER JOIN Payments ON Sections.[ID Number] = Payments.[ID Number]) ON (Sections.[ID Number] = [Personal Information].[ID Number]) AND ([Personal Information].[ID Number] = Payments.[ID Number])
WHERE ((([Personal Information].[ID Number])=1001 Or ([Personal Information].[ID Number])=1002));

Can anyone help me with this?
~Kris
Feb 6 '10 #1
10 6663
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi, and Welcome to Bytes!

Unfortunately, Access is somewhat limited when it comes to DELETE queries. You cannot use a join in an Access delete query to delete rows across multiple tables the way you might expect.

As Access will only delete rows from a single table at a time, you will have to perform several delete queries one after the other to accomplish what you want to do - one each for tables Payments, Section, and Personal Information. If the tables are related 1-many you need to delete the many-side entries first before you try to delete the one-side entries.

There is an alternative, which is to have the cascade delete option set when defining the one-to-many relations for the tables involved. I would not recommend this approach, however; it is rather dangerous, because if you accidentally delete a one-side row by mistake all many-side rows for that entry will be deleted at the same time as a result of the cascaded delete.

-Stewart
Feb 6 '10 #2
Anon93
2 New Member
Hmm, I actually do have the cascade delete option set, however, my relationships are a one to one type. Although, I took your advice and it seemed to have worked out.

Thank you!
~Kris
Feb 6 '10 #3
jspeta
3 New Member
Your table requires a primary key in order to delete a row
Mar 17 '21 #4
isladogs
457 Recognized Expert Moderator Contributor
@jspeta
Welcome to the forum. In case you aren't aware this is an 11 year old thread.

Although it is certainly good practice to have a primary key field in each table, you can definitely delete records from an Access table using a query even if there isn't a PK field. Try it and you will see it works

However, you cannot use a query to delete records from a linked SQL Server table unless it has a PK field.
Mar 17 '21 #5
jspeta
3 New Member
@isladogs
--
Yes, I know it is an old thread. No one had a solution in this thread. If anyone comes now , they will know what to do
Mar 17 '21 #6
isladogs
457 Recognized Expert Moderator Contributor
Actually there was a solution in the thread...cascade delete.
But the fact remains that if its an Access table, no primary key is required to run an update query.
Mar 17 '21 #7
NeoPa
32,557 Recognized Expert Moderator MVP
JSPeta:
Yes, I know it is an old thread. No one had a solution in this thread. If anyone comes now , they will know what to do
Well, there are two problems with that.
  1. There was already a valid answer that is actually correct.
  2. The solution you proposed is not correct, so only leads any readers away from a true understanding.
Feel free to dig up old threads, but do yourself a favour and consider carefully before posting something that may need to be corrected later by others.

While we accept that members come in at all levels of competence and they offer what they can according to that competence, we will feel obliged to correct misinformation when it's posted as we want people to come here and find reliable information & help. It hurts the reputation of the site when people post stuff that is inaccurate. Not to mention that it's not helpful for those reading it either.
Mar 18 '21 #8
jspeta
3 New Member
@NeoPa
I don't know your background, mine is working with MS Access since 1998 and I'm a DBA for SQL Server since 2000. My solutions fixes this problem . There a lot of "newbees" on the internet forums that are trying to get there. you have a good day
Mar 18 '21 #9
twinnyfo
3,653 Recognized Expert Moderator Specialist
jspeta,

My apologies that your experience on Bytes was not up to your standards. I'm not going to sling hash, here, but it seems a little arrogant to become a member of a forum and on the same day, might I say politely, "insult" one of the moderators (and a very well-respected one, at that) who has 10,000 times more posts than you do. I don't give my loyalties easily, but once I do, I will defend those loyalties. NeoPa has probably forgotten more about MS Access than I will ever know or understand, and he doesn't need me to defend him--but I will.

Back to the actual question, whether the record has a PK or not is immaterial. A delete query will not work in the manner the OP described. I've experienced the same behavior in Access with my heavily PK'ed database. My experience tells me that complex JOINs will not allow DELETE to function. That is the answer.

I hope you have a great day as well!
Mar 18 '21 #10
NeoPa
32,557 Recognized Expert Moderator MVP
I have just had encouragement from the owner to calm things down in here a little. We have a new member who has possibly come in and ruffled some feathers. To them (JSPeta) I would just say please be aware of what you say and give some consideration to how it may be perceived. Enough on that.

To those others, myself included, let's remember that JSPeta is new here and possibly much of what they've said is a defensive reaction to the responses that were triggered, but clearly unexpected. A step back should help. I know that all of us here are old enough (and ugly enough) not to be too sensitive about what others say about us. If ordinary members were involved it might be different but all here can be considered to have skins of rhino.
JSPeta:
I don't know your background, mine is working with MS Access since 1998 and I'm a DBA for SQL Server since 2000.
Welcome to Bytes.com. As a new member here let me advise that a click on any member's icon/ID will take you to their profile & bio. You can find out about me there, as well as IslaDogs & TwinnyFo if you choose.
JSPeta:
My solutions fixes this problem.
(Your table requires a primary key in order to delete a row)
Unfortunately that is not the case. I'm not sure you paid a great deal of attention to earlier posts that explained this so I will post a picture where I created a brand new database, a table with a single field without any PK, and then proceeded to delete one of the records from that table with a simple delete query. This is something you can try for yourself very easily.



As moderators & experts here at Bytes.com we care deeply that we don't allow misinformation to be reflected in the solutions we provide. I'm confident you posted with every good will. I imagine you also have a great deal of experience using Access & SQL Server. In this case though, you were mistaken. I would suggest you accept that just as I've had to once or twice. I certainly hate it when it happens but there's no doubt I've been pulled up by other experts when I've got something wrong. I do what I can to keep that to a minimum ;-)

Perhaps if you continue to post you can show that as being a simple abberation and that you still have a lot to offer.
Attached Images
File Type: jpg DelNoPK.Jpg (57.3 KB, 310 views)
File Type: jpg DelNoPK2.Jpg (57.3 KB, 311 views)
Mar 18 '21 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4358
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
16211
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
1
8391
by: Aravind | last post by:
we have two files: 1. rc4.c (defines one function "create_pin()") 2. MyImpl.c(calling the function "create_pin()"),This implements JNI method. 1.When I am trying to create .dll file with one...
1
6381
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32...
5
5681
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
3
4560
by: Andrew Luke | last post by:
Hi all you C++ guru's! I'm 'very, very' new to C++ and I'm having a little trouble configuring my VS environment I think - when I try and compile some sample code I'm getting the following...
13
6569
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
4976
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
19391
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
7126
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,...
0
7168
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,...
0
7210
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...
1
6891
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...
0
5465
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,...
1
4916
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...
0
4595
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...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.