>LPARAMETERS tcSql, tcAlias >LOCAL lnSelect, lcSql >*** Preserve Work Area >lnSelect = SELECT(0) >*** Cursor does not exist >IF NOT USED( tcAlias ) >*** Create it directly >lcSql = tcSql + " INTO CURSOR " + tcAlias + " READWRITE" >&lcSqlI usually simply create my grid cursor in Form's Load method with CREATE CURSOR command. You can have variety of different options here - copy structure to array and create a cursor from array, would be one.
>ELSE >*** Cursor does exist, use a safe select here >lcSql = tcSql + " INTO CURSOR curdummy" >&lcSql >*** Clear and Update the woirking cursor >SELECT (tcAlias) >ZAP IN (tcAlias) >APPEND FROM DBF( 'curdummy' ) >USE IN curdummy >ENDIF >*** Restore work area and return status >SELECT (lnSelect) >RETURN USED( tcAlias ) >>not worked in VFP6!