Thanks Vlad for your input.
>Hi!
>
>You require to set RecordSource property to "" BEFORE you close the record source that was there. Otherwise, as soon as grid see that its record source is closed or gone away from visibility scope, grid will be completelt reconstructing. In other words, the code for changing record source should be following:
>
>
>* first of all, clear the record source
>thisform.Grid1.RecordSource=""
>
>* close previous record source alias, do requery, PACK, re-create cursor etc. - whatever actions
>* needed to refresh data
>* ....
>
>* set record source back for grid
>thisform.Grid1.RecordSource="MyNewAlias"
>
>
>You can read more about grid reconstrcution and columns re-binding (there is another problem as well) in the VFP Grids Part I article on this site.
>
>>Hello
>>
>>I have some code in the keypress event of a textbox in a grid (based on a table) and i have a command button to delete the contents of the table.
>>
>>what's happening is first time when form is run keypress event works fine,but when command button is clicked and grid gets refreshed by setting recordsource="" and again resetting the keypress doesn't fire.
>>
>>how to make the keypress to fire after the delete.
>>
>>
>>txs