Delete Field Value in a Tbl

Mac1206

Board Regular
Joined
Jun 3, 2016
Messages
184
I have a Table (A) which I need to delete a field value based off another filed in that table..Delete Field_Value = YES WHERE Field_Maryland = Toys Example:

Field_Maryland Field_Value
Toys Yes

So if my Field_Maryland = TOYS, DELETE Field_Value = YES...Thanks in Advance
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Can you provide example data?
The description is confusing because the syntax is wrong and the names of the fields are very strange.
 
Upvote 0
I believe you are looking for an Update Query. But I am not quite clear what exactly you are trying to delete.

Is your criteria just that Field_Maryland is equal to "TOYS", or does the Field_Value must also be "YES"?
Then, which value are you trying to remove, the "TOYS" or the "YES"?
 
Upvote 0
I believe you are looking for an Update Query. But I am not quite clear what exactly you are trying to delete.

Is your criteria just that Field_Maryland is equal to "TOYS", or does the Field_Value must also be "YES"?
Then, which value are you trying to remove, the "TOYS" or the "YES"?
Field_MarylandCountryField_Value
ToysUSYes
ToysCAYes
ToysMXYes
RESULT FOR ABOVE TBL
Field_MarylandCountryField_Value
ToysUS
ToysCA
ToysMXYes

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
Why is the "Yes" removed from the first two records but not the third?
 
Upvote 0
Those are the results I'm trying to reach, I need to delete all Toys Field_Values that equal YES that are from US and CA....Thanks
 
Upvote 0
I need to delete all Toys Field_Values that equal YES that are from US and CA
OK. That second part is criteria you did not mention until just now. You want to make sure that you post a clear, complete question so we can see exactly what you are after. Otherwise, the answer you get might not work for and do exactly what you are looking for (since we would be working off of incomplete information).

It sounds like you just need a simple Update Query, where you add the three fields shown, using Criteria of "TOYS" for Field_Maryland and In ("US","CA") for Country, and Update the Field_Value field to Null.

The SQL code will look something like the following (though you should also be able to build this pretty easily using the Query Builder):
Code:
UPDATE TableA SET TableA.Field_Value = Null
WHERE (TableA.Field_Maryland="TOYS") AND (TableA.Country In ("US","CA"));
 
Last edited:
Upvote 0
OK. That second part is criteria you did not mention until just now. You want to make sure that you post a clear, complete question so we can see exactly what you are after. Otherwise, the answer you get might not work for and do exactly what you are looking for (since we would be working off of incomplete information).

It sounds like you just need a simple Update Query, where you add the three fields shown, using Criteria of "TOYS" for Field_Maryland and In ("US","CA") for Country, and Update the Field_Value field to Null.

The SQL code will look something like the following (though you should also be able to build this pretty easily using the Query Builder):
Code:
UPDATE TableA SET TableA.Field_Value = Null
WHERE (TableA.Field_Maryland="TOYS") AND (TableA.Country In ("US","CA"));
Thank you, I'm still learning Joe but I greatly appreciate your teams patience with me...Exactly what I needed...
 
Upvote 0
No problem! Glad I was able to help!:)

With action queries (like Update, Append, Delete), I find the easiest way to do it is to first build a simple Select Query that returns all the records you want to take the action to.
Once you have that, then just change the query type, make the change to the appropriate field.
 
Upvote 0
No problem! Glad I was able to help!:)

With action queries (like Update, Append, Delete), I find the easiest way to do it is to first build a simple Select Query that returns all the records you want to take the action to.
Once you have that, then just change the query type, make the change to the appropriate field.
Roger That...Thanks again Joe....
 
Upvote 0

Forum statistics

Threads
1,221,700
Messages
6,161,371
Members
451,700
Latest member
Eccymarge

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top