*-- grid.Init() *-- open cursor in Read-Write mode so that we can add index tags =CursWrit(This.RecordSource) * Program...........: CURSWRIT.PRG *) Description.......: Re-opens a CURSOR created with SQL in read-write mode. *) : RETURNs .t. if successful * Calling Samples...: * Parameter List....: tcAlias - optional CURSOR ALIAS * Major change list.: *-------------------------------------------------------------------------------------------------- LPARAMETER tcAlias *-- check parameter. If omitted, default to currently selected ALIAS() IF TYPE("tcAlias") <> "C" OR EMPTY(tcAlias) tcAlias = ALIAS() ENDIF IF USED(tcAlias) SELECT (tcAlias) LOCAL lcDbf lcDbf = DBF() && get handle to CURSOR lcTempAlias = "A" + SYS(3) && temp name USE (lcDbf) AGAIN IN 0 ALIAS (lcTempAlias) && open temp cursor in read-write mode USE (lcDbf) AGAIN ALIAS (tcAlias) && re-open CURSOR with original ALIAS USE IN (lcTempAlias) && close temp cursor RETURN .t. ELSE *-- ALIAS not in use RETURN .f. ENDIF>>Will,
>However, in some situations, especially those where the query result is then used in a subsequent query or where you want to index the cursor, having only a filtered view of the original causes problems. In VFP 3 and earlier versions, you worked around this by putting something in the query that outwitted FoxPro. Starting in VFP 5, it's a lot easier—just add NOFILTER to the query and FoxPro always creates a real cursor. >>