Dear Sirs,
I have the following VBA Code, which I wish to Modify:-
SELECT L.*, R.*
FROM ((SELECT L.ID AS leftRec, R.ID AS rightRec FROM (SELECT A.ID, Count(B.ID) AS rownum
FROM Tbl_Images AS A INNER JOIN Tbl_Images AS B ON A.ID>= B.ID WHERE True GROUP BY A.ID)  AS L LEFT JOIN
(SELECT A.ID, Count(B.ID) AS rownum
FROM Tbl_Images AS A INNER JOIN Tbl_Images AS B ON A.ID>= B.ID WHERE True GROUP BY A.ID)  AS R ON L.rownum+1 = R.rownum
WHERE ((([L].[rownum] Mod 2)=1)))  AS X INNER JOIN Tbl_Images AS L ON X.leftRec = L.ID) INNER JOIN Tbl_Images AS R ON X.rightRec = R.ID;
The Advice I have been given to modify the code is :-
For sorting, you would need to change the join part A.myTablePK>= B.myTablePK in both the green sections to the field you are sorting on - i.e. to A.fieldName>=B.fieldName for ascending and B.fieldName>=A.fieldName for descending.
with regards filtering you will need to apply criteria to both the green parts of the above query and not use the form filter functionality - replace True with whatever your filter requirements are - which is good practice anyway. I've included the WHERE True to hopefully make it easier to for you to edit, it is not actually required in this example

However no matter what combination I try I cannot get either of these modifications to work !

Any Advice would be much appreciated

Best Regards

Keith