I personally use TDBgrid in Delphi and also the Dataset is Adoquery. I've many record that have the ID from 1 to 1000. Now for instance I wish to remove the 35th by TadoQuery 'Delete from...' Can there be in whatever way to instantly focus the 34th or 36th record for that customer to see if the 35th continues to be erased. Here's the code for my remove button

StudentID := UniQuery1.FieldValues['StudentID'];
UniQuery1.SQL.Text :=('Delete from Student where StudentID = ''' + StudentID + '''');
UniQuery1.SQL.Add('select * from Student');

Anybody might help, thanks greatly.

If you are using a TClientDataSet (which may be beneficial anyway), you should use FindNearest.

To begin with, save the id from the tuple previous to the one which you need to remove. Then remove the tuple that you want to remove, and later on locate the saved tuple. To get at the prior tuple, use uniquery1.moveby (-1).

Save UniQuery1.RecNo before removing. After removing, re-query the dataset, that ought to set the very first record active, then problem UniQuery1.MoveBy(SavedRecNo - 1) or UniQuery1.MoveBy(SavedRecNo - 2), based on whether you need to proceed to the record succeeding or preceding the erased one.