Instead of saving the record number, save the primary key or a unique value of one of the columns, then use LOCATE to go back to that record.
John
>I have a grid which the user can sort by any of the columns.
>
>Until recently, the user did this by right-clicking to get a pop-up menu, and one of the choices allowed sorting by the selected column. The sort routine would always do a "GOTO TOP" to put the user back at the top of the newly sorted grid.
>
>I have recently added the capability to click on the column header, which sorts immediately (no pop-up).
>
>Since these are now duplicate capabilities, I have been asked to modify the behavior when right-clicking on one of the rows in the grid: if the user chooses the option to sort the column, he still wants the grid sorted, BUT he wants to remain on the same record that he right-clicked on.
>
>I can't get this to work. Previously, by code looked like:
>
> INDEX ON bla-bla-bla
> GOTO TOP
>
>which works properly, sending the user to the top record.
>
>The new code, which does not work properly, looks like:
>
> lnRecNO=RECNO()
> INDEX ON bla-bla-bla
> GOTO (lnRecNO)
>
>This code doesn't fail, but appears to place the user on some random record in the grid.
>In fact, on some occasions, it even gets the correct record.
>
>Any suggestions?
>Thanks