Conditional Update Query

I

Ican Modjo

Hi,

I need to update a field (AR13) in an access table, if they matched
certain criteria (CASE and AR001A Fields). Specifically I want to
update something such as:

Update Table.X
IF CASE=137103301 AND AR001A=1 THEN AR13=2;
IF CASE=137103301 AND AR001A=2 THEN AR13=2;
IF CASE=321914107 AND AR001A=7 THEN AR13=4;

Any help would be greatly appreciated.

Thanks
 
M

Michel Walsh

Hi,



Try with an inner join.

Updating ' table name
CaseOf, Ar001a, UpdatingTo ' Fields name
137103301 1 2
137103301 2 2
321914107 7 4


Then, in a new query bring both table (the one to be updated, let call it
"tobe", and the one above). Join tobe.caseof with Updating.caseOf, and also
join tobe.ar001a with Updating.ar001a. Change the query type from a select
to an update query type. In the grid, bring tobe.ar13, under it, in the line
Update to, type
[Updating].[UpdatingTo]

That's all. (use the real name for your situation)

Hoping it may help,
Vanderghast, Access MVP
 

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