>>>>Thanks Cetin;
>>>>But what am I doing wrong. I'm trapped in an endless loop. I stop
>>>>the program and check the value of grid.relativerow and it's 0.
>>>Becky,
>>>Sorry it would be doscroll(1). In debugger it would be always 0. It works when grid has focus. If you want to do it from outside of grid ie: commandbutton.click:
with thisform.mygrid
>>> .setfocus
>>> do while .relativerow # 1
>>> .doscroll(1)
>>> enddo
>>>endwith
>>>this.setfocus
Cetin
>>
>>Would not be easier just issue Grid.Refresh ? After this grid should show the current record on top of visible portion.
>Not sure Ed, must test. AFAIK grids tend to show the record centered horizontally when refreshed.
>BTW : A more enhanced version should check the relative row (might be negative) and scroll(0) in case.
>Cetin
Yes, I test now on bigger table and see that Refresh centers it. Sorry for misleading :).
Edward Pikman
Independent Consultant