Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table for controlsource not found
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00057660
Message ID:
00057960
Views:
29
>>I have a form with a big grid whose .RecordSource is the one table in the DE. If I set grid.ColumnCount = -1, the form works fine, with the grid showing me all fields in MyTable. If I make a column and set the .controlsource = MyTable.Myfield, it gives me Error Loading File - controlsource - record number 4 - Alias 'Mytable' is not found. My controlsource was selected using the little combo in that field in the properties form, so I didn't have the opportunity to mis-type the controlsource. What's going on?
>
>Bret, check in your DataEnvironment to see if AutoOpen is .T. Next try to re-create the grid using the standard VFP builder.
>
>HTH
>Barbara

My DE.AutoOpenTables = .F. because I have a class to change the .Database path to the current folder. I instantiate the database path-changing class in the .Load of the form class. It always worked until now. Setting my DE.AutoOpenTables to .T. makes the form work, and effectively hard codes the path to the table, which is unacceptable. Here is my path-changing code:

In the form class .Load:
SET TALK OFF
oChangeDataPath = CREATEOBJECT('datafolder')
oForm = THISFORM
oChangeDataPath.curfolder(oForm)
RELEASE oChangeDataPath
RELEASE oForm
My "datafolder" class has a method called .curfolder which looks like this:
PARA oFormcalled
* This class resets the paths of tables in the data environment
* to CURDIR()
IF PARAMETERS() = 0
	RETURN
ENDIF
IF TYPE("oFormcalled.DataEnvironment") = "O"
	oEnviron = oFormcalled.DataEnvironment
ELSE
	RETURN
ENDIF
IF TYPE("oEnviron") = "O"
	nTotMem = AMEMBERS(aMems,oEnviron,2)
	WITH oEnviron
		IF .AutoOpenTables = .F.
			* Check for cursors
			FOR i = 1 TO m.nTotMem
				IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "CURSOR"
					WITH EVAL("."+aMems[m.i])
						STORE .Database TO cDB
						cDB = SUBSTR(cDB,RAT('\',cDB)+1)
						.Database = SUBSTR(FULLPATH(cDB),1,RAT('\',FULLPATH(cDB)))+cDB
					ENDWITH
				ENDIF
			ENDFOR
			.OpenTables()
		ENDIF
	ENDWITH
ENDIF
RELEASE oEnviron
I tried a WAIT WINDOW in the .Load just before the code that instantiates the class, but the error occurs before it hits the .Load code.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform