>>>Our application needs to switch DBCs for different data sets. The
>>>structure for each is the same but the data is different. Our form Data Environment is tied to the name of the DBC. I have tried setting the name of the desired DBC in the DE method - before tables are opened, but to no avail. (I used set database to ...)
>>>
>>>What is the best way to overcome this? I could ask the DE not to open/close the tables and open them explicitly, but would prefer to let the DE do its work if there is a simpler approach. It would be preferable if I could set the database once at the beginning of the application.
>>>
>>>Thanks much,
>>>Nancy
>>Hi Nancy,
>>This one is from thread #
67659, Title-"Question abt. dataenvironment"
>>
>>* Dataenvironment.beforeopentables
>>cNewDataPath = _screen.comment
>>set path to (cNewDataPath)
>>nDataObjects = amembers(aMyArray,this,2)
>>cOldPath = this.&aMyArray[1]..database
>>cNewDbPath = cNewDataPath+substr(cOldPath,rat("\",cOldPath))
>>for ix = 1 to nDataObjects
>> if this.&aMyArray[ix]..baseclass = "Cursor"
>> this.&aMyArray[ix]..database = cNewDbPath
>> endif
>>endfor
>>
>>Here is a way to change path at runtime using above :
>>
>>*Method processing user data path
>>lparameters cNewDataPath, fForm
>>_screen.comment=cNewDataPath
>>do form (fForm)
>>
>>Cetin
>
>Cetin, this method can bomb if you have free tables in DE.
Hi Edward,
I wouldn't really post it if I saw yours. This one was for a project where all tables are in a DBC with DBC name and/or path cahnging. You're right it assumes there is no free table.
Cetin