>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 >ENDFORJust looking at this, I have no idea why you get the record in use error. I would put an ASSERT at the beginning of the GO_INSERT proc and SET ASSERTS ON in the command window. Then do your append blank. Use the debugger to step through the code until you hit the error. You might also table buffer the audit table before you append the record.