>Ok. Here is the story.
>
>I open my table
>I index on every field in my table
>I createobj("form")
>I addobject("grid")
>I set the record source
>I loop thru the columns, removing header1 and adding myhead1
>I define a custom click event in myhead1 that does a set order and a thisform.refresh.
>
>I run the form. Everything looks swell... but then I click on header. The column gets resorted. Yeah! I click on another header, the grid gets sorted by that, Yeah!
>
>But then I noticed that even if I have clicked on a row in the grid, when I click on the header, I end up on a random row. Why doesn't it stay on the same row? How can I predict what row its going to go to?
That sounds like normal behavior, it's staying on the same record, not necessarily the row. Usually, with a new sort, you either want to:
1) stay on the same record, which is what yours is doing, I think?
2) go to the top
So, are you sure it's purely random and not #1 here?
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.