>I am trying this code to sumarize de credits and date of table 1 into
>credit and legend of cursorTemp, where legend = month name
>
>I am using the code below but it is not working:
>
>
>SELECT table1
>SCAN
> SELECT tempCursor
> LOCATE FOR tempCursor.CLEGEND = CMONTH(table1.date)
> IF NOT FOUND()
>
> APPEND BLANK IN tempCursor
> replace tempCursor.credit WITH table1.credit
> replace tempCursor.cLegend WITH CMONTH(table1.data)
>
>ELSE
> REPLACE tempCursor.CREDIT WITH tempCursor.credit + table1.CREDIT
> replace tempCursor.cLegend WITH CMONTH(table.date)
>
> ENDIF
>
>ENDSCAN
Except the for typo Alan mentioned (table1.data), and the typo he missed (table.date) your code seems to work. I think you could get the same thing with
SELECT CMONTH(date) clegend,sum(credit) credit FROM table1 GROUP BY 1;
INTO CURSOR tempCursor
although that would change the order of the records into alpha by month.
If you need it in calendar order you could try....untested, I don't have VFP 9 on this machine
SELECT clegend,credit;
FROM(SELECT MONTH(date), MAX(CMONTH(date)) clegend,sum(credit) credit FROM table1 GROUP BY 1);
INTO CURSOR tempCursor