IF loCursor.CURSORFILL (.F., .F., 0, loCommand) cCursorMade = cTable_name SELECT &cTable_name. IF(cOutput_type = "VFP_DBF") THEN LOCAL lcSafety, lcOutputFileName STORE "" TO lcSafety, lcOutputFileName lcSafety = SET("Safety") lcOutputFileName = IIF(AT(".", cOutputFileName) > 0, ; LEFT(cOutputFileName, AT(".", cOutputFileName) - 1), ; cOutputFileName) SET SAFETY OFF llok = deletedbffiles(cOutputFileName) && delete the physical files if there are any. CREATE DATABASE (lcOutputFileName + "dbc") COPY TO ALLTRIM(lcOutputFileName) DATABASE (lcOutputFileName + "dbc") <-- this is where it errors SET SAFETY &lcSafety. ENDIF ELSETIA