It's one of the grids 'features". They'll re-select their RecordSource if you try to select another table, as long as the grid has focus.
>In my app I have a class for my System Parameters form which uses the Sysdata.dbf table to store user preferences. The sysdata table is opened when my app starts and remains opened. In the LOAD event of the class I have the following code:
>
>
>IF !USED('sysdata')
> ERROR 'Initialization Failed: File Sysdata.dbf not open.'
> RETURN .F.
>ELSE
> SELECT sysdata
>ENDIF
>
>
>This works fine for selecting the sysdata table when it is not the current alias, in most cases. The problem is when my main application form is active and the focus is set to the Grid that is on a pageframe on that form, the above select command doesn't work. If the focus is on any control other than a Grid on that form and the System Parameters form is instantiated it works fine.
>
>Why when a grid has focus can I not Select another table in code?
>
>Thank you in advance.
--sb--