LOCAL ; lnArea, ; luKey, ; lcPK, ; lcRecordState, ; lcChanges, ; lcDataType, ; lcTransType, ; lcDBC, ; lcTable, ; lcField, ; lcKey, ; lcKeyType, ; lcFieldType, ; lcOldFieldValue, ; lcCurFieldValue, ; lxOldFieldValue, ; lxCurFieldValue, ; lcUserID, ; i lnArea = SELECT() lcPK = GetPrimaryKey( lnArea ) luKey = EVAL( lcPK ) lcChanges = "" lcTable = JUSTSTEM(DBF()) lcDBC = JUSTSTEM(DBC()) lcKeyType = VARTYPE(luKey) * Assign the character representation of the key * to lcKey for storage in the log table DO CASE CASE INLIST(lcKeyType, "N", "Y") lcKey = ALLTRIM(STR(luKey)) CASE INLIST(lcKeyType, "C", "M") lcKey = luKey CASE lcKeyType = "D" lcKey = DTOC(luKey) CASE lcKeyType = "L" lcKey = IIF(luKey,"T","F") OTHERWISE RETURN .F. ENDCASE * Determine Trigger Type lcRecordState = GETFLDSTATE(-1) DO CASE CASE LEFT(lcRecordState,1) = "2" AND DELETED() lcTransType = "D" CASE LEFT(lcRecordState,1) = "2" AND ! DELETED() lcTransType = "I" CASE "3" $ lcRecordState OR "4" $ lcRecordState lcTransType = "I" CASE "2" $ lcRecordState lcTransType = "U" ENDCASE * Loop through all fields in the updated recordHere is the GetPrimaryKey function... just add it at the end of the logit function:
FUNCTION GetPrimaryKey ( tnArea ) LOCAL nCount, nNumTags, cKey nNumTags = TAGCOUNT( "", tnArea ) FOR nCount = 1 TO nNumTags IF PRIMARY( nCount, tnArea ) EXIT ENDIF ENDFOR &&* nCount = 1 to nNumTags cKey = SYS(14, nCount, tnArea) RETURN cKey ENDFUNCBOb