LOCATE RECORD m.RecNo IF EOF() SKIP -1 ELSE SKIP +1 IF EOF() SKIP -1 ENDIF ENDIFThis moves to the next valid record, or if such one doesn't exist, to the previous one. By moving to the next first, instead of the opposite way, you get one positive effect on the UI. If the table is shown in a list, the highlighted row now stays at the same place. If you would move to previous record first, the highlight would move upwards in most cases.