The problem is caused because the data environment saves the fullpath of the tables used at design time.
I´ve had the same problem, and after looking here and there, came to a solution:
Put this code in the beforeopentables event of the dataenvironment of every form:
m.UseDataEnv = (TYPE("THISFORM.DataEnvironment") = "O")
IF m.UseDataEnv
nTotMem = AMEMBERS(aMems,THISFORM.DataEnvironment,2)
WITH THISFORM.DataEnvironment
* Check for cursors
FOR i = 1 TO m.nTotMem
IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "CURSOR"
M.NOM_CURSOR = AMEMS(M.I)
M.DBF_PARENT = .&NOM_CURSOR..DATABASE && Guarda el nombre de la dbc
M.DBF_PARENT = SUBSTR(M.DBF_PARENT,RATC("\",M.DBF_PARENT) + 1) && Le quita el directorio
IF NOT EMPTY(M.DBF_PARENT) AND FILE (M.DBF_PARENT)
.&NOM_CURSOR..DATABASE = M.DBF_PARENT && Le indica la dbc del path actual.
ENDIF
ENDIF
ENDFOR
ENDWITH
ENDIF
This code is designed to work when the database (*.dbc) and tables (*.dbf) reside all in the same directory, wichever it is.
It´s more professional to put this code in a method in the class in wich you based all your forms if any. you still need to go to beforeopentables of every dataenvironment and call the method.
Hope it work!!
There´s a better life... Just it´s more expensive!
Cristóbal Manrique M.