my grid's recordsource is a table i have created by code. when i recreate the table the grid appears with default properties of the grid. how can i correct it ?You should not re-create the table. Instead, you should do what I call a "safe select". Basically, the idea is that you do a SELECT into a CURSOR, ZAP the grid's RecordSource, and then APPEND FROM DBF( 'MyCursor' ). Code similar to this (if you add a custom method to your grid class called ResetGrid):
SELECT ( This.RecordSource )
ZAP
SELECT Yada, Nada, Blah FROM SomeTable WHERE SomeCondition INTO CURSOR csrJunk NOFILTER
SELECT ( This.RecordSource )
APPEND FROM DBF( 'csrJunk' )
USE IN csrJunk
GO TOP IN ( This.RecordSource )
This.Refresh()
Another alternative is to use a parameterized view for the grid's RecordSource and REQUERY it with the new parameter when you have to change the data in the grid.