Hi. Instead of trying to do this in code for such a one-off task I'd generate a temporary table listing the values of all three fields, with a fourth field for the new value of RSEQ which you wish to set, and update the RSEQ field to the new value by joining these tables accordingly.
It should be straightforward to use a query to extract your current composite key values into Excel, say, then create the new key value as a fourth column and paste the four columns back as a new table into Access.
For simplicity I have just given simple table and field names in the example below, with F1 to F3 for your existing fields and F4 for the replacement value of F3:
- UPDATE tblTestUpdate INNER JOIN tblUpdateNewKey ON
-
-
(tblTestUpdate.F3 = tblUpdateNewKey.F3) AND
-
(tblTestUpdate.F2 = tblUpdateNewKey.F2) AND
-
(tblTestUpdate.F1 = tblUpdateNewKey.F1)
-
-
SET tblTestUpdate.F3 = [f4];
-
You would have to be careful that in renumbering your existing field you do not create duplicates of some existing values which would violate the integrity of the composite key and therefore not be updateable. For example, you could not renumber a composite value of 1, 1, 1 to 1, 1, 5 if the value 1, 1, 5 already exists in your table.
There are two advantages to this approach. Firstly, in joining to the existing composite key value there are no issues with changing what is already indexed (as long as there are no key violations), and secondly you have a physical mapping table available showing what changes were made which you can use to undo those changes if need be.
-Stewart