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, 6 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
-
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
1 hour, 37 minutes ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
1 hour, 39 minutes ago -
Drivers suggested via Windows Update
by
Tex265
1 hour, 30 minutes ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
13 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
8 hours, 30 minutes ago -
Apple releases 18.5
by
Susan Bradley
2 hours, 55 minutes ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
9 hours, 56 minutes ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
10 hours, 33 minutes ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
17 hours, 30 minutes ago -
No HP software folders
by
fpefpe
18 hours, 15 minutes ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
2 hours, 12 minutes ago -
Stay connected anywhere
by
Peter Deegan
23 hours, 37 minutes ago -
Copilot, under the table
by
Will Fastie
14 hours, 50 minutes ago -
The Windows experience
by
Will Fastie
1 day, 5 hours ago -
A tale of two operating systems
by
Susan Bradley
20 hours, 48 minutes ago -
Microsoft : Resolving Blue Screen errors in Windows
by
Alex5723
1 day, 11 hours ago -
Where’s the cache today?
by
Up2you2
2 days, 2 hours ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
1 day, 19 hours ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
19 hours, 37 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
1 hour, 55 minutes ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
2 days, 19 hours ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
2 days, 19 hours ago -
regarding april update and may update
by
heybengbeng
2 days, 21 hours ago -
MS Passkey
by
pmruzicka
1 day, 23 hours ago -
Can’t make Opera my default browser
by
bmeacham
3 days, 5 hours ago -
*Some settings are managed by your organization
by
rlowe44
2 days, 15 hours ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
3 days, 3 hours ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
3 days, 23 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
4 days, 8 hours ago -
AI slop
by
Susan Bradley
2 days, 2 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.