Field borders simply don't work with sliding fields in tabular format like this.
The simple solution is to remove all borders and put in a horizontal line graphic object as the Bottom border for each row of fields (make it a single line spanning the width of the screen) and set it to also slide up and resize. Then don't even try to get side borders working, just rely on "white space" to visually separate your columns of data.
But if you really want to get those side borders, try this:
Draw in verictical line graphic objects for the side borders. Carefully position the line's start so that it is just below but not on the dividing line between the body and the preceding layout part. Extend the line down until just one pixel crosses into the next body part. Then sort your records as appropriate for your sub summary parts and enter preview mode to see if the result is acceptable.
Will give it a try. Do you think that's what the original I'm using for inspiration did? Or do you think he used repeating fields?
Either option is possible. It's one of the few cases where a repeating field has a clear advantage over a set of related records.