How to make a next and previous button?

How to make a next and previous button?

Hi,
 
I would like to find the index number for a given record ID. Here is example,
 
markRec = market [ID=123456];
 
and then find the index number
 
indexRec = market[ID!=0] range from markRec.index to markRec.index;
 
Reason for doing this:
I can build a next or previos button to fetch the previous or next record.
 
Any suggestion?
Many thannks.