The code I provided over at AWF does what was required at that time. This seems to require something different - I don't understand the actual requirement. given the structure of the query and the suggestion I made a year ago and and the one made in post #5 here does not work for you then I suspect what you want to do is not possible. As requested in post #2 show some example data, the result you get at the moment and the result required from that example data.
it may be you need to modify not just the A.myTablePK>= B.myTablePK in both sections, but also the GROUP BY A.myTablePK
Code:
The Trouble i am having is changinf the join part to sort using a command button.....
what command button? I don't see it in your attachment. And what code have you tried so far?