>>PROCEDURE ChangeMade >> do go_insert with 2 >> >>PROCEDURE RecInsert >> do go_insert with 1 >> >>PROCEDURE RecDelete >> do go_insert with 3 >> >>PROCEDURE getp_key >> LOCAL lnp_key >> lnp_key = 0 >> calculate max(mpart.p_key) to lnp_key >> return lnp_key+1 >> >>PROCEDURE go_insert >>* Values passed: 1-add(insert or recall), 2-update, 3-delete. >>LPARAMETERS lnchange > ><b>ASSERT .F.</b> > >>LOCAL lnresults, lcfname, lcrplfield >>&& open the audtrail table if it's not open and append a blank >>IF !USED("audtrail") >> use audtrail in 0 >>ENDIF >>select audtrail >>append blank >> >>* Set the change type and p_key fields >>replace changetype with lnchange in audtrail >>replace p_key with mpart.p_key in audtrail >> >>&& Create an array with the field names in the mpart table. >>select mpart >>lnFields = AFIELDS(laFields) >>FOR I = 1 TO lnFields >> lnresults = getfldstate(lafields(I,1)) >> IF lnresults = 2 >> lcrplfield = "mpart."+alltrim(lafields(I,1)) >> lcfname = lafields(I,1) >> replace &lcfname with &lcrplfield in audtrail >> ENDIF >>ENDFOR>