how do I renumber a priority field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field for priority for tasks. Once a task is completed I have an
update to number the completed task as 0. Now I would like to renumber the
exisiting priorities that are greater than zero to reflect the correct order.
Any suggestions?
 
How about something like the following?

UPDATE yourTable
SET PriorityField = IIF(PriorityField=10,0,PriorityField-1)
WHERE PriorityField >= 10

If you are using a parameter query
Parameter [Set Priority n to Zero] Long;
UPDATE yourTable
SET PriorityField = IIF(PriorityField=[Set Priority n to Zero]
,0,PriorityField-1)
WHERE PriorityField >= [Set Priority n to Zero]

WARNING: Test on a copy of your table and/or make a backup first.
 
Back
Top