Hi Marcia,
>
>>> Is there some way to requery a 6.0 grid without having to re-define grid properies? <<
>
>The easiest way to do this is to define a parameterized view and use that as the RecordSource for your grid. Thn, when you have to change the grid's contents, you just Requery() the view with a different paramter.
>
>Another technique that I use is what I call a "safe" select. I define an updateable cursor in the form load and use that as the RecordSource of the grid. Then, when I want to requery the grid's contents, I zap it's RecordSource, do a SELECT into a temporary cursor, and append from the temporary cursor into the grid's RecordSource. Zapping the grid's RecordSource will not reset the grid because it does not close the RecordSource.
>
Thanks for this technique. I've just implemented it. I think, it's important to empasize, that you should use this syntax in append command:
append from (dbf('myCursor'))
append from myCursor doesn't work (I spent some time before I understood this problem).
This is an example, how I implemented your idea:
lparameters cSQL
thisform.lockscreen = .t.
cSQL = stuff(cSQL,atc(" from",cSQL),;
0,",.f. as lSelected,.f. as lLastSelected,recno() as rcno")
cSQL=cSQL+' into cursor myCursor'
&cSQL
select (this.AliasName)
zap
append from (dbf('myCursor'))
if used('MyCursor')
use in mycursor
endif
thisform.lockscreen = .f.
Thanks again.
If it's not broken, fix it until it is.
My Blog