Remove status = D, K, W, and C

G

Guest

Hello,
I'd like to remove records where the status is either "D", "K", "W" or "C".
The "status" field contains a single letter.

Thanks in advance for your help,
Ellen
 
S

Stefan Hoffmann

hi,
I'd like to remove records where the status is either "D", "K", "W" or "C".
The "status" field contains a single letter.

DELETE FROM yourTable
WHERE [status] IN ("D", "K", "W", "C")


mfG
--> stefan <--
 
J

John

Create a new query and add your table with this data to the query. Add
the field that contains the status letters to the query (along with
any other fields you like). In the criteria section below the field
name that contains this status letter, enter:

In ("D","K","W","C")

Change the query type to "Delete" (The methods to do this will vary
depending on whether you are using Access 2003
or 2007) You'll get a warning message...click "OK on this." If you
think there's any reason that you might need these records again, back
up the table first.
 
G

Guest

Thanks, Stefan. I tried the query. It removed the letters "D", "K", "W" or
"C" from the status field, whereas I wanted those records removed. Perhaps
I missed something.

When I did a make-table from the query where status criteria is

<>"D" And Not Like "K" And Not Like "W" And Not Like "C"

I got the table I was looking for.

Stefan Hoffmann said:
hi,
I'd like to remove records where the status is either "D", "K", "W" or "C".
The "status" field contains a single letter.

DELETE FROM yourTable
WHERE [status] IN ("D", "K", "W", "C")


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi Ellen,
Thanks, Stefan. I tried the query. It removed the letters "D", "K", "W" or
"C" from the status field, whereas I wanted those records removed. Perhaps
I missed something.
Maybe. What do you mean with "I wanted those records removed"?

Do you want to delete these records?
Or do you want do "empty" the status of these records?
When I did a make-table from the query where status criteria is
<>"D" And Not Like "K" And Not Like "W" And Not Like "C"
This is the opposit.
I got the table I was looking for.
This is not "either "D", "K", "W" or "C". " as you wrote in your first
posting.


mfG
--> stefan <--
 
G

Guest

Thanks John and Stefan. Both your posts contained the answer. (I reran
Stefan's code.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top