>I have the following code that takes forever to run. Can anyone suggest ways of speeding up the process?
See FAQ #8109 for some ideas.
As a general rule, the index on deleted() that Andy suggested usually makes things
slower, but in certain circumstances it speeds things up.
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)