I'm always a little iffy about using For Each too much. If you have a lot of stuff onscreen, I can imagine it causing slowdown at some point.
The way I do it relies on collisions instead, also using a family for all objects.
+"Sprite" overlaps "All"
+Sub: Sprite.Y > All.Y
-Sprite - move in front of All
+Sub: Sprite.Y < All.Y
-Sprite - move behind All
That way you only check and change the Z order when it's actually necessary (when things collide).
Though you do have to have these events for every object that might change it's Z order.