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:
thisform.Grid1.RecordSource=""
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
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.