>Hello,
>
>I hope somebody can help me with my problem.
>I have a grid in which a user can search for part numbers via incremental search.
>This procedure works fine in the Key Press event of the grid's text field (column1).
>But when I remove the linked table with a sql statement or a new table (same structure) the keypress procedure is not available any more.
>Do you have any idea how I can solve this.
>(We use VFP 6)
>
>Thanks
>
>Marcus
Reassigning the grid RecordSource forces the grid to rebuild itself, so it is loosing its formatting. Before you reassign the Recordsource you have to set
grid.recordsource = ""
Then you assign the grid recordsource again and in most cases column controlsources too if they are not in the default field order.
In case of SQL statement as a recordsource I would recommend to use the parameterized view instead. REQUERYng the view with the new parameters does not cause the grid reconstruction.
For more details see FAQ#8019
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison