>>Unless I am missing something, it seems to search in the datsession in which it was created.
>
>I don't think so. Honestly, I don't use private datasessions so my knowledge here is quite limited, but logically any external code should access current datasession.
Alex is right. Objects always live in the datasession they were created in, unless they explicitly SET DATASESSION TO.
Say I have a custom class that has a method that returns whether or not a certain table is open.
USE MyTable
oTest = CREATEOBJECT("Tester")
?oTest.IsOpen() && Return .T.
* Now, get a new datasession
loSession = CREATEOBJECT("Session")
SET DATASESSION TO (loSession.DataSessionID)
?USED("Campus") && Returns .F., because it is open in the original datasession
?oTest.IsOpen() && Return .T., because the Test object is still living in that datasession
DEFINE CLASS Tester AS Custom
PROCEDURE IsOpen
RETURN USED("MyTable")
ENDDEFINE
Alex, this has nothing to do with object or variable scope. Objects are scoped according to the scope of the variable that references them, completely untied from datasession. The only thing that datasession dictates is which work areas an object has access to at any given time.
Erik Moore
Clientelligence