>An app runs from the directory of the currently selected company. During design, however, files in dataenvironment are in a different directory.
>
>1) To get around problem I plan to change the path of files in dataenvironment in the BeforeOpenTables event. This could be done in each form's BeforeOpenTables method or better in a dataenvironment class, and then setting DEClass and DEClassLib in the form class. Unfortunately, setting DEClass loses the content of all my forms dataenvironment. Is there a way to change DEClass and yet save the work defining dataenvironments?
>
>2) Is there a better way to solve the original problem?
>
>------------ some time later ----------
>I tried do hack form and change dataenvirionment class, but found that once that is done you can't add cursors to form, so that approach is out.
>
>And the solution is... add the following method, which does the work, to form class and make a call to the new method from dataenvironment's beforeopentables().
>
>
>LOCAL laMembers[1],lnObjects,loCursor
>lnObjects = AMEMBERS(laMembers,This.DataEnvironment,2)
>FOR i = 1 TO lnObjects
> loCursor = EVALUATE('This.Dataenvironment.' + laMembers[i])
> IF UPPER(loCursor.Baseclass) = 'CURSOR'
> loCursor.CursorSource = JustFName(loCursor.CursorSource)
> ENDIF
>ENDFOR
>
Alejandro,
Instead just rename original data folder to something else and use 'set path'.
ie: Dataenvironment has 'c:\development\data\myData.dbc' as database path.
If you rename 'c:\development\data' to say ''c:\development\datax' and set path to data folder you want to use, VFP uses tables from your set('path').
PS: And this is version independant.
Cetin