Just a point of clarification. The SELECT command in the question does not
create a table. It creates a cursor. What's the difference? A table resides
on disk and is generally considered permanent. A cursor may reside totally
in memory, is read-only by default, and is automatically deleted when
closed.

Signature
Craig Berntson
Microsoft MVP
-------------
Yes that is a temporary cursor. But afterthat SELECT * .... command the
creating cursor should be selected, but it not happens like that. Im calling
that prg by doubleClicking the grid. Therefore the grid recordsource table
is always selected. Because of that the creating cursor is not selecting.
Is there any way to avoid this.?
> Just a point of clarification. The SELECT command in the question does
> not create a table. It creates a cursor. What's the difference? A table
[quoted text clipped - 14 lines]
>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
>> lcAliasAfter = ALIAS()
Craig Berntson - 11 Jul 2008 15:49 GMT
Explicitly SELECT the cursor/table you want

Signature
Craig Berntson
Microsoft MVP
-------------
> Yes that is a temporary cursor. But afterthat SELECT * .... command the
> creating cursor should be selected, but it not happens like that. Im
> calling that prg by doubleClicking the grid. Therefore the grid
> recordsource table is always selected. Because of that the creating cursor
> is not selecting.
> Is there any way to avoid this.?
Fred Taylor - 11 Jul 2008 23:38 GMT
The grid ALWAYS wants to have as the current area its recordsource. You'll
have to either move the Focus off the grid to some other control before you
do your SQL SELECT, or you'll have to SELECT the cursor before you try to
use it.

Signature
Fred
Microsoft Visual FoxPro MVP
> Yes that is a temporary cursor. But afterthat SELECT * .... command the
> creating cursor should be selected, but it not happens like that. Im
[quoted text clipped - 21 lines]
>>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
>>> lcAliasAfter = ALIAS()
Anders Altberg - 12 Jul 2008 22:55 GMT
Hi Marc
Functions that operate on cursor, practically always take the cursorname as
a last, optional parameter.
Commands tha operate on table proctacally always take an optional clause 'IN
cursoralias'
Make a habit of using them and you don't have to very much about selecting a
workarea.
-Anders
> Yes that is a temporary cursor. But afterthat SELECT * .... command the
> creating cursor should be selected, but it not happens like that. Im
[quoted text clipped - 21 lines]
>>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
>>> lcAliasAfter = ALIAS()