Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Environment blow out
Message
From
28/07/2003 16:51:01
 
 
To
28/07/2003 16:30:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00814319
Message ID:
00814340
Views:
8
>This is very interesting. I first tested it by creating a form and loading a table in the form's load event and then loading a 2nd table in the form's data environment. I ran the form and it worked fine. Both tables were available on the grids. Then I saved the form as a class to cut/paste the code to create the form in a prg and called the form with CREATEOBJECT() and lo and behold, the dataenvironment gets hosed as you mentioned:


How ya been Tracy? Yes it is, I always considered it a MS bug. The thing that ticked me off is that I have been working on an very technical loan servicing program for about 4 years and added a lot of code and objects to forms. Well, when I started using VFP I saw how you could drop tables into the dataenvironment and thought what the heck, that is pretty cool and easy, not knowing this effect would happen when I wanted to actually code to use tables with names that I have to use code with (such as part of the name of a table being a username) and found it blew the thing out, it kinda annoyed me. I can change the cursorsource in code for a template table with the same structure, but again blow out and reload the data, and I have some rather large tables on the network to reload. I am so busy all the time and I have a major amount of code and objects in these forms. It is gonna be a major pain to remove all tables from the dataenvironment and code them in, but if it is a bug and there is no solution I guess I will have to go that route.



>
>
>SET SAFETY OFF
>SELE 0
>CREATE TABLE TEST (cname c(15))
>SELE test
>APPEND BLANK
>REPLACE test.cname WITH "Smith"
>SELE 0
>CREATE TABLE TEST2 (cfname c(15))
>SELE test
>APPEND BLANK
>REPLACE test2.cfname WITH "Betty"
>CLOSE TABLES
>
>oform=CREATEOBJECT('Testform')
>oform.show()
>READ EVENTS
>RETURN
>
>**************************************************
>*-- Class:        testform (c:\profiler\progs\testform.vcx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   07/28/03 04:26:01 PM
>*
>DEFINE CLASS testform AS form
>
>
>	Top = 0
>	Left = 0
>	Height = 287
>	Width = 422
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>
>
>	ADD OBJECT grdtest2 AS grid WITH ;
>		Height = 107, ;
>		Left = 72, ;
>		RecordSource = "test2", ;
>		RecordSourceType = 1, ;
>		Top = 18, ;
>		Width = 320, ;
>		Name = "grdTest2"
>
>
>	ADD OBJECT grid1 AS grid WITH ;
>		Height = 107, ;
>		Left = 72, ;
>		RecordSource = "test", ;
>		RecordSourceType = 1, ;
>		Top = 154, ;
>		Width = 320, ;
>		Name = "Grid1"
>
>
>	ADD OBJECT label1 AS label WITH ;
>		Caption = "Test2 opened in data environment", ;
>		Height = 17, ;
>		Left = 12, ;
>		Top = 0, ;
>		Width = 216, ;
>		Name = "Label1"
>
>
>	ADD OBJECT label2 AS label WITH ;
>		Caption = "Test opened in form load event", ;
>		Height = 17, ;
>		Left = 12, ;
>		Top = 132, ;
>		Width = 204, ;
>		Name = "Label2"
>
>
>	PROCEDURE Load
>		SELE 0
>		USE test
>		GO TOP
>	ENDPROC
>
>
>	PROCEDURE Unload
>		USE IN TEST
>		CLEAR EVENTS
>		ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: testform
>**************************************************
>
>
>>Why is it that if you make a simple form and want to throw free tables in the data environment instead of coding use of them that if you use one table through code that is not in the data environment it blows the whole data environment out and you then have to dataenvironment.opentables to reload them making the program inefficient? Is there any easy way around this other than to recode the whole form so that all tables are opened with code?
``` Appreciate a normal day, it is always better than a bad one ```

Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform