>PROCEDURE UpdateEmailLog(tcText, tcCustno, tcDisposition) > >LOCAL lnSelect, llUpdated > >lnSelect = SELECT() > >SELECT emails > >llUpdated = .F. > >DO WHILE !llUpdated > > IF FLOCK() > APPEND BLANK > REPLACE em_body WITH tcText, ; > em_datetim WITH DATETIME(), ; > em_custno WITH tcCustno, ; > em_disptn WITH tcDisposition > > UNLOCK > llUpdated = .t. > ENDIF > >ENDDO > > >SELECT (lnSelect) > >RETURN >This will show you a much better code. Append Blank followed by Replace is bad, you should never use it again! Instead use Insert as I told you earlier.
Function UpdateEmailLog(tcText, tcCustno, tcDisposition) Local llSuccess As Boolean, ; lnSelect As Number, ; lnX As Number m.lnSelect = Select() m.llSuccess = .F. For m.lnX = 1 To 10 Try Insert Into emails (em_body, em_datetim) Values m.tcText, Datetime() m.llSuccess = .T. Exit Catch Endtry Endfor Select(m.lnSelect) Return m.llSuccessNote that this is a function, not a procedure. The advantage is that you can check the return value, if it's .F. something went wrong. I also specified a maximum number of tries, to avoid that the system hangs if something fails.