>What does this do? Specifically '#'? --->iResult # -1
From on-line help:
SQLEXEC( ) returns the number of result sets if there is more than one. SQLEXEC( ) returns 0 if it is still executing and returns 1 when it has finished executing. SQLEXEC( ) returns –1 if a connection level error occurs.
I'm not 100% sure but I think SQLEXEC() will only return 1 or -1, unless you have configured the connection to allow asynchronous execution. The default is for control not to return to VFP until the SQLEXEC is complete.
The # is the same as <>. I.e. if there was no error then you can try copying the records to a real dbf. You could expand the check to include that the "MyNewCursor" exists and actually contains records e.g.
IF iResult # -1 AND USED( "MyNewCursor" ) AND RECCOUNT( "MyNewCursor" ) > 0
COPY TO ....\path\MyRealDbf
ENDIF
censored.