=SetDBCPath(thisform.Dataenvironment,gcDBCNetwkPath,"Catalog")The parameter "gcDBCNetwkPath" is a global that defines the database path; the last parameter is the database name to change the path for. The UDF is as follows:
FUNCTION SetDBCPath PARAMETER poForm,pcDBCPath,pcDBCName LOCAL lcDBCName, lcFilePath, lnNumCursors, lnNdx lcDBCName = FORCEEXT(pcDBCName,"DBC") lcFilePath = ADDBS(pcDBCPath) + lcDBCName lnNumCursors = AMEMBERS(lcProperties,poForm,2) FOR lnNdx=1 TO lnNumCursors IF UPPER(LEFT(lcProperties[lnNdx],6)) = "CURSOR" IF ATC(lcDBCName,poForm.&lcProperties[lnNdx]..database) > 0 poForm.&lcProperties[lnNdx]..database = lcFilePath ENDIF ENDIF ENDFOR RETURN ENDFUNCIf you need to update for a free table, the following UDF is used:
FUNCTION SetDBFPath LPARAMETERS poForm,pcDBFPath LOCAL lnNumCursors, lnNdx, lcDBFName LOCAL ARRAY lcProperties[1] lnNumCursors = AMEMBERS(lcProperties,poForm,2) FOR lnNdx=1 TO lnNumCursors IF UPPER(LEFT(lcProperties[lnNdx],6)) = "CURSOR" IF EMPTY(poForm.&lcProperties[lnNdx]..database) lcDBFName = JUSTFNAME(poForm.&lcProperties[lnNdx]..CursorSource) poForm.&lcProperties[lnNdx]..CursorSource = pcDBFPath + lcDBFName ENDIF ENDIF ENDFOR RETURN ENDFUNC