I have a customer database in which I want to delete all customers who do not have orders i.e. Customer table (1 side) orders table (many side). When I try to run a delete query containing the unmatched records, access tells me it can’t delete, or it tells me it has deleted but when I go to the table the records are still there. If I go to the customers table I can in fact delete records individually but this will take me forever to pick out all those without orders (few thousand customers)! I have opened with exclusive rights, the file is not read only, I have tried deleting all other relationships and removed referential integrity. How can I remove these records?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Can’t Delete (2K)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Can’t Delete (2K)
- This topic has 4 replies, 3 voices, and was last updated 23 years, 5 months ago.
AuthorTopicWSPlainsman
AskWoody LoungerOctober 26, 2001 at 9:07 pm #362017Viewing 0 reply threadsAuthorReplies-
WSJayden
AskWoody Lounger -
WSPlainsman
AskWoody Lounger -
WSJayden
AskWoody LoungerOctober 27, 2001 at 2:56 am #548905Hmmmm
Your SQL looks fine to me, but in saying that, when I recreated the situation in a brand new database, I got exactly the same error message. I spose that Jet has some deep dark reason for not being able to do it (although the MS access help file explicitly states that DELETE works with one-to-many relationships).
I can offer a workaround. It isn’t very elegant, but I think that it would work.
Firstly, instead of using your query as a delete query, use it as a make table query (with all fields from the customers table). Call the table a temporary name. Run this, and this should now be a Customer table (with a temporary name), but with only Customers with Orders.
Now use a DROP statement in a query to delete the Customers table (DROP TABLE Customers)
Then use the DoCmd.Rename statement from Visual Basic to rename the temporary Customers table to the ‘live’ Customers table.
Yeah, messy I know, but it should work.
Anyone else know what is wrong with the DELETE query?
J
-
WScharlotte
AskWoody LoungerOctober 27, 2001 at 4:02 am #548918In Access 2000, you must use the DISTINCTROW keyword in delete queries or they will simply refuse to execute. Change your SQL to this:
DELETE DISTINCTROW Customers.*, Orders.CustomerID
FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE (((Orders.CustomerID) Is Null));
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
1 hour, 50 minutes ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
3 hours, 18 minutes ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
9 hours, 41 minutes ago -
Mail from certain domains not delivered to my outlook.com address
by
pumphouse
12 hours, 7 minutes ago -
Is data that is in OneDrive also taking up space on my computer?
by
WShollis1818
1 hour, 31 minutes ago -
Nvidia just fixed an AMD Linux bug
by
Alex5723
1 day, 14 hours ago -
50 years and counting
by
Susan Bradley
1 hour, 54 minutes ago -
Fix Bluetooth Device Failed to Delete in Windows Settings
by
Drcard:))
20 hours, 46 minutes ago -
Licensing and pricing updates for on-premises server products coming July 2025
by
Alex5723
2 days, 1 hour ago -
Edge : Deprecating window.external.getHostEnvironmentValue()
by
Alex5723
2 days, 1 hour ago -
Rethinking Extension Data Consent: Clarity, Consistency, and Control
by
Alex5723
2 days, 1 hour ago -
OneNote and MS Word 365
by
CWBillow
2 days, 3 hours ago -
Ultimate Mac Buyers Guide 2025: Which Mac is Right For You?
by
Alex5723
2 days, 3 hours ago -
Intel Unison support ends on Windows 11 in June
by
Alex5723
2 days, 3 hours ago -
April 2025 — still issues with AMD + 24H2
by
Kevin Jones
2 days, 3 hours ago -
Windows 11 Insider Preview build 26200.5518 released to DEV
by
joep517
2 days, 15 hours ago -
Windows 11 Insider Preview build 26120.3671 (24H2) released to BETA
by
joep517
2 days, 15 hours ago -
Forcing(or trying to) save Local Documents to OneDrive
by
PateWilliam
3 days ago -
Hotpatch for Windows client now available (Enterprise)
by
Alex5723
2 days, 11 hours ago -
MS-DEFCON 2: Seven months and counting
by
Susan Bradley
1 day, 12 hours ago -
My 3 monitors go black & then the Taskbar is moved to center monitor
by
saturn2233
3 days, 8 hours ago -
Apple backports fixes
by
Susan Bradley
2 days, 15 hours ago -
Win 11 24H2 will not install
by
Michael1950
1 day, 13 hours ago -
Advice to convert MBR to GPT and install Windows 11 Pro on unsupported PC
by
Andy M
6 hours, 55 minutes ago -
Photos from iPhone to Win 10 duplicating/reformatting to .mov
by
J9438
1 day, 21 hours ago -
Thunderbird in trouble. Here comes Thundermail
by
Alex5723
9 hours, 24 minutes ago -
Get back ” Open With” in context menus
by
CWBillow
3 days, 23 hours ago -
Many AMD Ryzen 9800X3D on ASRock have died
by
Alex5723
2 days, 15 hours ago -
simple general stupid question
by
WSaltamirano
3 days, 21 hours ago -
April 2025 Office non-Security updates
by
PKCano
4 days, 14 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.