The following select query gives me the set of records I want to delete: - SELECT tblCaseNumbers.*
-
FROM (tblCaseNumberDump INNER JOIN [dbo_Final Action] ON tblCaseNumberDump.SSN = [dbo_Final Action].[Primary SS#]) INNER JOIN tblCaseNumbers ON [dbo_Final Action].[Master ID] = tblCaseNumbers.ProspectKey
-
WHERE (([IDENT]=IIf(Right([ACCT],1)='D','D',IIf(Right([ACCT],1)='A','PLP', IIf(Right([ACCT],1)='B','SLP','M')))));
-
When I try to make it a delete query however: - DELETE tblCaseNumbers.*
-
FROM (tblCaseNumberDump INNER JOIN [dbo_Final Action] ON tblCaseNumberDump.SSN = [dbo_Final Action].[Primary SS#]) INNER JOIN tblCaseNumbers ON [dbo_Final Action].[Master ID] = tblCaseNumbers.ProspectKey
-
WHERE (((tblCaseNumbers.Ident)=IIf(Right([ACCT],1)='D','D', IIf(Right([ACCT],1)='A','PLP',IIf(Right([ACCT],1)='B','SLP','M')))));
-
The delete won't work. I am assuming that it is because of the join? Unfortunately, I cannot change the table structure here. All relationships must remain intact. Can anyone help me on this? I would prefer not to do it with ADODB recordsets....
I am writing a series of queries here. The idea is to take data from a spreadsheet (tblCaseNumberDump) and put it in a usable format in tblCaseNumber. tblCaseNumberDump does not have the foreign key in it, so I am using the SSN as an identifier (it is unique in that table). In tblCaseNumbers, SSN is not unique. The key is a combination of the ProspectKey and Ident. The point of this delete query would be to delete any values in tblCaseNumbers where new data is coming.
Thanks,
Josh
3 1765
What table is [ACCT] in? Try the following BTW, reordering the tables may solve the problem. -
DELETE tblCaseNumbers.*
-
FROM tblCaseNumbers INNER JOIN (tblCaseNumberDump INNER JOIN [dbo_Final Action]
-
ON tblCaseNumberDump.SSN = [dbo_Final Action].[Primary SS#])
-
ON tblCaseNumbers.ProspectKey=[dbo_Final Action].[Master ID])
-
WHERE tblCaseNumbers.Ident=
-
IIf(Right([ACCT],1)='D','D',
-
IIf(Right([ACCT],1)='A','PLP',
-
IIf(Right([ACCT],1)='B','SLP','M')));
-
ACCT is in the tblCaseNumberDump table. I tried your query below and got the same error message "could not delete from specified tables"
Thanks.
What table is [ACCT] in? Try the following BTW, reordering the tables may solve the problem. -
DELETE tblCaseNumbers.*
-
FROM tblCaseNumbers INNER JOIN (tblCaseNumberDump INNER JOIN [dbo_Final Action]
-
ON tblCaseNumberDump.SSN = [dbo_Final Action].[Primary SS#])
-
ON tblCaseNumbers.ProspectKey=[dbo_Final Action].[Master ID])
-
WHERE tblCaseNumbers.Ident=
-
IIf(Right([ACCT],1)='D','D',
-
IIf(Right([ACCT],1)='A','PLP',
-
IIf(Right([ACCT],1)='B','SLP','M')));
-
OK this is getting a little creative. Back up your table first in case it all goes wrong. -
DELETE tblCaseNumbers.*
-
FROM tblCaseNumbers
-
WHERE tblCaseNumbers.Ident=
-
IIf(Right([ACCT],1)='D','D',
-
IIf(Right([ACCT],1)='A','PLP',
-
IIf(Right([ACCT],1)='B','SLP','M')))
-
AND tblCaseNumbers.ProspectKey=DLookup("[Master ID]","dbo_Final Action","[Primary SS#]=tblCaseNumberDump.SSN");
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: robert |
last post by:
been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.
i assume that there is a threshold on the number of columns of
the...
|
by: Mike Wiseley |
last post by:
I would like to create a delete query that consists of two tables linked
together. One table will be the target for the deletions while the other
table's equi-joins will tell the delete query which...
|
by: Dave Burt |
last post by:
Hi, Access officionados,
I'm new here, so please cut me slack/gently tell me off if I'm out of line
or in the wrong place.
OK, here's something that seems silly (and is also problematic to...
|
by: Karl O. Pinc |
last post by:
Hi,
Thought perhaps some other eyes than mine can tell if I'm doing
something wrong here or if there's a bug somewhere. I've never
passed a ROWTYPE varaible to a function but I don't see where...
|
by: Ignoramus6539 |
last post by:
There were some strange requests to my server asking for config.php
file (which I do not have in the requested location).
I did some investigation. Seems to be a virus written in perl,...
|
by: (PeteCresswell) |
last post by:
I've got apps where you *really* wouldn't want to delete certain items by
accident, but the users just have to have a "Delete" button.
My current strategies:
Plan A:...
|
by: Matt |
last post by:
I am writing a DELETE statement and I want to filter the records using
another SELECT statement.
My SELECT statement is a GROUP BY query that grabs all social security
numbers from the "Data...
|
by: Bob Bridges |
last post by:
Start with two tables, parent records in one and child records in the other,
a one-to-many relationship. Create a select statement joining the two.
Display the query in datasheet mode. When I...
|
by: pythonnoob |
last post by:
Hello everyone. New to python as well as this forum, but i must say ive learned a but already reading through some posts. Seems to be a pretty helpful community here.
Before i post a question...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |