When the records are sorted by title, the displayed record is not updated because the ‘id’ column in the table does not match RecIndex which is the position of the record in the table. For example, Manhattan is record number 5 but its id is 7. I think you need to sort the records by id not title so that when they are being displayed on the screen one at a time, they are displayed by ascending ‘id’ instead of title.
You still have to adjust the code for the fact that the positions of the records are 0 to 9, but the id’s vary from 1 to 10