> >If 'tmpfil' is an alias, you should issue
> >Thisform.Grid.RecordSource="tmpfil"
> >and don't forget to refresh
>
> In my prg I have:
> [tmpfil='tmp'+sys(2)
> copy to &tmpfil
> use &tmpfil
> do form bgrid1]
> but I get "unknown member grid" error mess.
In your program, it's ok to have:
tmpfile = tmp+sys(2)
copy to &tmpfile
use (m.tmpfile) alias GridSource
and then have:
Thisform.Grid.RecordSource = "GridSource"
This will allow the grid to always see the same alias, as was suggested.
As to the other point: your data is jumbled. This is because the
RecordSource file closes and then re-opens. In this process, the all of
the customization is lost. Before the RecordSource file changes, you
should issue:
Thisform.Grid.RecordSource = ""
and after it changes you should issue:
Thisform.Grid.RecordSource = "GridSource"
to restore the data. This will preserve the mappings of the fields, and
other customization that you have made to the grid (like the ReadOnly
property).
HTH