Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unable to switch database used by a form
Message
De
24/10/2002 04:56:06
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Unable to switch database used by a form
Divers
Thread ID:
00714713
Message ID:
00714713
Vues:
48
How do we change database a form bound to at runtime?

I tried the following with tsBaseForm class (Tastrade sample app):

Load event:
x=this.dataenvironment.objects[1].database
this.dataenvironment.objects[1].database= strtran(x,'C:\','D:\')

Then I created MyForm based on tsBaseForm. I put Customer table in its dataenvironment and set DE's AutoOpenTables to .F.
I also dragged Customer table from DE to form so it created a grid with RecordSource property set to Customer.

When I run MyForm (from inside Tastrade app, of course) it went fine but when I back to form designer and change grid.column.ControlSource to customer.Name (previously empty) and run the form again an error appeared:

Data environment is already UNloaded.
Method: myform.dataenvironment.CloseTables
Line: 0

When I chose Ignore, another error came up but with blank message. When I click Ignore I threwn back to menu (the form never run)

It seems that problem occured if I change grid.column.ControlSource to something other than "(None)" (default).

What I'm looking for is a workaround other than open tables manually in form.Load

Thank you in advance
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform