UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Deleting Records By Criteria, Access 2010    
 
   
Sowa222
post Nov 28 2017, 11:10 AM
Post#1



Posts: 100
Joined: 23-March 17



I want to delete the records containing the ZHU entry from the table.
but only if the number occurs more than once

removal scheme

Identyfikator numer tekst
1 3698 ZHU Delete
2 3698 jakiś tekst
3 3698 jakiś tekst
4 3698 ZHU Delete

5 2589 ZHU we do not remove

6 888 ZHU Delete
7 888 jakiś tekst
8 888 jakiś tekst
9 888 jakiś tekst

10 999 ZHU we do not remove
Attached File(s)
Attached File  Delete_record.zip ( 23.85K )Number of downloads: 5
 
Go to the top of the page
 
doctor9
post Nov 28 2017, 11:24 AM
Post#2


UtterAccess Editor
Posts: 17,924
Joined: 29-March 05
From: Wisconsin


Sowa222,

Try this:

DELETE * FROM ttt
WHERE DCount("*","ttt","numer=" & [numer])>1 AND tekst="ZHU";

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
RJD
post Nov 28 2017, 11:28 AM
Post#3


UtterAccess VIP
Posts: 7,850
Joined: 25-October 10
From: Gulf South USA


Hi: Try this ...

DELETE Identyfikator
FROM ttt
WHERE tekst="ZHU" AND DCount("*","[ttt]","[numer]=" & [numer])>1;

(Tested)

HTH
Joe

AH ... Looks like Dennis beat me to it. Shouldn't have taken that phone call in the middle of testing this!

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
Sowa222
post Nov 28 2017, 12:45 PM
Post#4



Posts: 100
Joined: 23-March 17



Oh no smile.gif but it works great
Thank you very much for your kindness, I will use both ways of your doctor9 and Mr. RJD
thank you very much
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th December 2017 - 05:47 AM