table.IS_RECORD_LOCKED Function
Syntax
Result_Flag as L = Is_Record_Locked()
Description
return TRUE if the record is locked.
Discussion
The <TBL>.IS_RECORD_LOCKED() method returns .T. (TRUE) if the current record is locked (i.e. another user or session has the record in change mode). Using the <TBL>.IS_RECORD_LOCKED() method is easy and fast, in large part because Alpha Anywhere no longer needs to make several attempts to get a lock on a record before reporting an error.
This script checks if the current record is locked before making a change.
dim tbl as P tbl = table.current() status = tbl.is_record_locked() if (.not. status) then tbl.change_begin() tbl.field1 = var1 tbl.change_end(.T.) else ui_msg_box("Error", "Record locked by another user") end if
See Also