The problem is if VFP can set a filter on the table you are selecting from, it will do so. Therefore, a temp file is not created. What you need to include in the Select command is a NOFILTER clause at the end of the command. This will create the temp file you will need. The code snippet is like:
SELECT * FROM mytable INTO CURSOR TempCur NOFILTER
use dbf("TempCur") again in 0 alias MyNewCursor
index on somefield tag somename
Using the dbf again is what makes the cursor read-write.
>If I execute the following statement with no databases active:
>
>SELECT * FROM mytable INTO CURSOR mycur
>
>and mytable.dbf is a table contained in database mybase.dbc then the "database" property of the resulting cursor will be:
>
>1) blank if DELETED is ON, or
>2) "mybase.dbc" if DELETED is OFF
>
>I discovered this because, in the respective cases, the following statements:
>
>SELECT mycur
>INDEX ON myfield TAG mytag
>
>1) create a temporary .cdx which VFP automatically
> deletes on exit (good!!)
>2) gives an error saying that the related .dbf is read-only(bad!!) (presumably because it's trying create the index in mytable.cdx)
>
>I am unable to find any documentation that describes this behavior.
>Can anyone explain what's going on or point me to documentation that will shed some light?
Mark McCasland
Midlothian, TX USA