>>>Is it possible to create a cursor from a SQL SELECT and then APPEND FROM to an existing table?
>>
>>Sure
>>
>>
SELECT * FROM table INTO CURSOR mycursor NOFILTER
>>SELECT anothertable
>>APPEND FROM (DBF("mycursor"))
>>
>>You could also SELECT ... INTO ARRAY then APPEND FROM ARRAY instead - depending on the size of the returned data set.
>
>I changed to an array and it gets done what I need, thanks!
I thought I posted a question but I must have done something wrong because it hasn't appeared. Anyhow the question was how to trap an empty array and the answer is:
After the SELECT, check the _TALLY system variable - I'd store it off in a variable so it can be referred to later, if necessary (see _TALLY in help for more detail on why), e.g.
SELECT * FROM.... INTO ARRAY lax
lnCnt = _TALLY
IF lnCnt > 0
SELECT table
APPEND FROM ARRAY lax
ELSE
MESSAGEBOX("No records found.")
RETURN
ENDIF
Jim Philippi
quando omni flunkus moritati