lparameters tcDbc, tcTbl local lcChr, lcDbf, lcOldSafety, lcOldTalk, lcPath, lnHdlIn, x, y #DEFINE MB_OK 0 #DEFINE MB_YESNO 4 #DEFINE MB_ICONEXCLAMATION 48 #DEFINE IDNO 7 * Update the User (memo) field in the Dbc to contain an empty Cdx file. if empty(tcDbc) tcDbc = GetFile("Dbc") else if !file(tcDbc) if at(".", tcDbc) = 0 tcDbc = rtrim(tcDbc) + ".Dbc" endif if !file(tcDbc) tcDbc = GetFile("Dbc") endif endif endif if !file(tcDbc) MessageBox("No valid Dbc supplied.", MB_OK, "Cannot update") return .F. endif if MessageBox("Are you sure you want to create the empty Cdx entries" + chr(13) ; + "in the User field of '" + tcDbc + "'" ; + iif(empty(tcTbl), "", chr(13) + "for Table '" + tcTbl + "'") + "?", ; MB_YESNO + MB_ICONEXCLAMATION, "Confirm") == IDNO return .F. endif x = rat("\", tcDbc) if x = 0 lcPath = ".\" else lcPath = left(tcDbc, x) endif lcOldSafety = set("Safety") lcOldTalk = set("Talk") set Safety off set talk off Set Exclusive Off use (tcDbc) alias DbcAsDbf shared if type("tcTbl") = "C" set filter to ObjectName = lower(tcTbl) endif count for ObjectType = "Table" to y x = 0 scan for ObjectType = "Table" x = x + 1 lcDbf = lcPath + rtrim(ObjectName) wait window "Saving " + lcDbf + chr(13) + str(x) + " of" + str(y) nowait if file(lcDbf + ".Cdx") && If no index, skip * Backup data copy file (lcDbf + ".Dbf") to (lcDbf + ".Dbf.Save") copy file (lcDbf + ".Cdx") to (lcDbf + ".Cdx.Save") if file(lcDbf + ".Fpt") copy file (lcDbf + ".Fpt") to (lcDbf + ".Fpt.Save") endif select 0 use (lcDbf + ".Dbf") exclusive zap use select DbcAsDbf append memo User from (lcDbf + ".Cdx") overwrite * Restore Data erase (lcDbf + ".Dbf") rename (lcDbf + ".Dbf.Save") to (lcDbf + ".Dbf") erase (lcDbf + ".Cdx") rename (lcDbf + ".Cdx.Save") to (lcDbf + ".Cdx") if file(lcDbf + ".Fpt") erase (lcDbf + ".Fpt") rename (lcDbf + ".Fpt.Save") to (lcDbf + ".Fpt") endif else replace User with "" in DbcAsDbf endif endscan wait clear close all open database (tcDbc) exclusive pack database Close Database if lcOldSafety = "ON" set safety on endif if lcOldTalk = "ON" set talk on endifHTH,