Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing a free table in Private Data Session
Message
De
28/08/1997 20:14:19
Edward Crawford
City Facilities Management
Glasgow, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00047219
Message ID:
00047459
Vues:
25
>>>>I have a form with a private data environment. I need to SELECT a free table that was "USED" earlier in the program. Since it is not a part of the data environment, it won't let me select it. It is a 2.6 table, so I can't add it to a Database. I don't want to add it to the DE as a free table because I don't want the location hard coded. How can I either select this free table or add it programatically to the DE.
>>>>
>>>>ED
>>>
>>>Ed, a free table should respond to USE and SELECT the same as a table in the DBC - I use them regularly. Check in your Datasession list (Window/Datasession menus) and look at the DS in question. If you don't see it, then start checking code for where it was closed (in my case it's usually a USE without the IN 0 clause) or whether it was called in the default datasession by mistake.
>>>
>>>HTH
>>>Barbara
>>
>>Barbara:
>>
>>I opened the table up outside of the form, so when I entered the form I couldn't select it. I could, however open it again in the Ini() method of the form, as you suggested. A strange thing though, relations that I set up visually and used to work fine have started acting strange when I changed the DE to Private. Is something that I missed when I changed the DE to private?
>>
>>Taanks
>>Ed
>
>Ed, try putting the code to open your table in the LOAD section instead of the init. That way all of your controls will have access to it.
>
>Also, I never set any relations graphically in the DE. I always code them in the LOAD event. In the DE, relations may not work correctly, depending on the order in which you added the tables to the DE (yes, that's strange, but several of us have seen it). Simply open all the tables, then in LOAD you run through any necessary relations.
>
>HTH
>Barbara

Hi Barbara:

I went ahead a did what you said. I think I discovered the problem. When I add a record to a table, I call a method that is not in the form. Here is the method (lcTable is the alias name of the table to add a record to)

LPARAMETERS lcTable

PRIVATE oldOrder

SELECT &lcTable
oldOrder = ORDER()

SET ORDER TO deleted
SET DELETED OFF
SEEK .T.
IF FOUND()
RECALL
SET DELETED ON
ELSE
SET DELETED ON
APPEND BLANK
ENDIF

SET ORDER TO oldOrder

When I do this I can see the data session changing from my private form DE to the default one, obviously because the method is not in the form. When I return to my form to REPLACE the data, the table is sitting on Record #1, not on the blank record. I don't see any way around this without placing this method in my form.

Ed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform