************************************************************************************************ * * Routine for setting the database directory location for the form * FUNCTION SetDBCPath LPARAMETERS poFormDE,pcDBCPath,pcDBCName LOCAL lcDBCName, lcFilePath, lnNumCursors, lnNdx lcDBCName = FORCEEXT(pcDBCName,"DBC") lcFilePath = ADDBS(pcDBCPath) + lcDBCName lnNumCursors = AMEMBERS(lcProperties,poFormDE,2) FOR lnNdx=1 TO lnNumCursors IF UPPER(LEFT(lcProperties[lnNdx],6)) = "CURSOR" IF ATC(lcDBCName,poFormDE.&lcProperties[lnNdx]..database) > 0 poFormDE.&lcProperties[lnNdx]..database = lcFilePath ENDIF ENDIF ENDFOR ENDFUNCThis is called in the Dataenvironment.BeforeTablesOpen() event:
SetDBCPath(this,gcDBCPath,"Data")Where "Data" is the name of the database, and gcDBCPath is the location of the database at runtime. The variable gcDBCPath is global (or can be a custom property added to _SCREEN) and determined at the start of the program. This will change the location of the tables within the database for the dataenvironment.
************************************************************************************************ * * Routine for setting the free table directory location for the form * FUNCTION SetDBFPath LPARAMETERS poFormDE,pcDBFPath LOCAL lnNumCursors, lnNdx, lcDBFName LOCAL ARRAY lcProperties[1] lnNumCursors = AMEMBERS(lcProperties,poFormDE,2) FOR lnNdx=1 TO lnNumCursors IF UPPER(LEFT(lcProperties[lnNdx],6)) = "CURSOR" IF EMPTY(poFormDE.&lcProperties[lnNdx]..database) lcDBFName = JUSTFNAME(poFormDE.&lcProperties[lnNdx]..CursorSource) poFormDE.&lcProperties[lnNdx]..CursorSource = pcDBFPath + lcDBFName ENDIF ENDIF ENDFOR RETURN ENDFUNC