Mandy,
Chris has given you the specific information you need. But let me try to answer your more general question about cursors and how they work.
As you probably know, a cursor is simply a temporary table. It has most of the characteristics of an ordinary table (that is, a DBF). The most important difference is that when it is closed, it gets deleted.
You can create a cursor explicitly, using CREATE CURSOR, or you can create it to hold the results of a SELECT - SQL statement, which is what you are doing. In the latter case, the cursor is read-only by default. If you want to update the cursor in any way, add READWRITE to the SELECT (again, as you are doing). (You also need READWRITE if you want to index the cursor.)
Unlike DBFs, cursors don't have a path. (They physically exist in your Windows Temp folder, but you don't need to know that.) This implies that every open cursor in your application has to have a unique name. If you create a cursor with the same name as one that is already open, that latter one will close and therefore be deleted.
One other point regarding your SELECT statement (not directly related to the issue of cursors):
Your first expression is [tt]ALLTRIM(sname) + ", " + ALLTRIM(fname)[/tt]. The problem with that is that it is variable length - different people will have different length names. To determine the width of the first field in the cursor, VFP looks at the first record in the source table. So if, in that record, the name is 8 characters wide, then the cursor field will be 8 characters wide. If the names in subsequent records are longer than that, they will be truncated. That is not what you want.
The solution is to make the expression fixed length, perhaps like this:
[tt]SELECT PADR(ALLTRIM(sname) + ", " + ALLTRIM(fname), 25), ....[/tt]
That will make the field 25 characters wide in every record.
Also, when you have an expression like this in a SELECT, the corresponding field in the result cursor will have an arbitrary name - something like Expr_1. This does not harm, but it would be better to give it a name that is more meaningful. You can do that by adding an AS clause:
[tt]
SELECT PADR(ALLTRIM(sname) + ", " + ALLTRIM(fname), 25) AS FullName, ...[/tt].
I hope the above will help you to better understand what is going on when you use cursors.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads