Hi
Try:
With ThisForm.Grid1
.recordSource = ""
.recordSource = "expence"
.refresh()
.setfocus()
EndWith
to avoid grid reconstruction.
I use this to assign a grid to a different table/alias as the one specified in design time and to keep out of going blank:
-set the tag of each column with the ControlSource, without alias part (only field name), in design time
-run this code after .RecordSource = ''
{Grid}.RecordSource = 'new_alias'
With {Grid}
For i = 1 To .ColumnCount
.Columns( i ).ControlSource = .Columns(i).Tag
Endfor
.Refresh()
Endwith
It is possible to encapsulate such functionality in the subclassed grid class used in applications, and all above code to be called by calling a grid custom method.
HTH
>I had a Refresh routine that refreshes the form, I added the following and all is fine.
>Thanks
>
>sele Table2 && expences
>With ThisForm.Grid1
> .recordSource = "expence"
> .refresh()
> .setfocus()
>EndWith
>sele Table1 && table for rest of form