>>Hi All:
>>
>>Every time I run a transaction, my program either APPENDs BLANK to a log table, or updates an existing record in the log table.
>>
>>What is the best resource to consult with regard to doing this in a multiuser environment?
>>
>>Thanks,
>>
>>Yossi
>
>Don't use Append Blank, use Insert Into instead, this is especially important in a multiuser environment. And in general you should never update a record in a log table, you should only add new records.
Are you saying that with INSERT INTO, I don't need flock()?
I guess that 'Log file' is inaccurate. It's a list of emails that have a lSent field. If the previous attempt was unsuccessful and it is successful now, I want to update the lSent to .t.
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