>I am completely stumped by this error (error 1815). The error is listed in the help as...
>
>*****
>"cursor" must be created with SELECT ... INTO TABLE (Error 1815)
>You have tried to use a repackaged cursor as a source for another SELECT statement.
>
>Some cursors cannot be used in successive queries.
>Use the INTO TABLE clause of the SELECT - SQL statement instead.
>*****
>
>Here is the code the generates the error. What stumps me is that this is a type of query that I do all of the time. The error occurs on the first line of the second SQL statement.
>
>An interesting observation is that when I try to browse cPPS1, a message says "lnRfid not found".
>
>Any ideas?
>
>*****
>
>FUNCTION patprog()
>PARAMETER lnRfid, ldDate
>
>SELECT status.* ;
> FROM status ;
> WHERE status.start <= ldDate AND ;
> status.rfid = lnRfid ;
> ORDER BY status.start ;
> into cursor cPPS1
>
>* select the oldest date and program (cursor sorted)
>IF USED("cPPS1")
> SELECT *, MAX(cPPS1.START) as maxstart ;
> FROM cPPS1 ;
> into cursor cPPS2
> * if nothing returned, return "NO PROGRAM"
> IF _tally < 1
> lnProgram = PADR("NO PROGRAM",80," ")
> ELSE
> lnProgram = PADR(cPPS2.program,80," ")
> ENDIF
>ELSE
> lnProgram = PADR("NO PROGRAM",80," ")
>ENDIF
>
>* close the cursors
>=closecursor("cPPS1")
>=closecursor("cPPS2")
>
>RETURN lnProgram
>
You should SELECT ... INTO CURSOR ... NOFILTER
BTW, it may generate error in VFP5 too
Edward Pikman
Independent Consultant