[AccessD] A2000: Multiple UPDATES in one query

Gustav Brock Gustav at cactus.dk
Mon Feb 7 08:48:21 CST 2005


Hi Steve

Couldn't you use IIf():

  UPDATE 
    tblTest
  SET 
    FieldToChange = IIf(FieldA = 5 AND FieldB = 6, 2, 1)
  WHERE 
    (FieldA = 5 AND FieldB = 6)
      OR
    (FieldA = 2 AND FieldB = 3);

/gustav

>>> erbachs at gmail.com 07-02-2005 15:33:34 >>>
Dear Group,

I'm converting a Paradox app to Access 2000. In the Paradox app
there's a bit of code that scans through all the records in a table
and changes the value in one field based on values in other
fields...essentially an UPDATE operation. There are only two possible
ways the data in the one field can be changed.

I thought to myself I thought, "Hey! Couldn't I just make an UPDATE
query out of this?" So I tried. But it looks to me as if one can only
UPDATE the field with one choice at a time:

UPDATE tblTest
SET FieldToChange = 2
WHERE ((FieldA = 5) AND (FieldB = 6));

But I'd also like this in the same query if possible:

UPDATE tblTest
SET FieldToChange = 1
WHERE ((FieldA = 2) AND (FieldB = 3));

Can I do that in one query? Does it take a UNION operator perhaps? I
think I'll try that.

-- 
Regards,

Steve Erbach
Scientific Marketing
Neenah, WI




More information about the AccessD mailing list