Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unable to switch database used by a form
Message
From
24/10/2002 04:56:06
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Unable to switch database used by a form
Miscellaneous
Thread ID:
00714713
Message ID:
00714713
Views:
47
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
Next
Reply
Map
View

Click here to load this message in the networking platform