The following function is used to lock individual records. If it fails, it uses LKSYS( ) to display information on who has the lock and when they got it. SET REPROCESS must be changed to 1 instead of 0 so that if the lock attempt fails the standard dialog, which does not have as much information, will not be displayed.

PROCEDURE RecLock

local cMsg 

do while .t. 

if rlock( ) 

return .t. 

else 

cMsg = "Locked by: " + lksys(2) + chr(13) + ; 

"since: " + lksys(1) + " " + lksys(0) 

if msgbox( cMsg, "Record is locked by another", 5 + 48 ) == 2 

return .f. 

endif 

endif 

enddo 

The MSGBOX( ) used is a Retry/Cancel dialog box. The button number, which MSGBOX( ) returns, is 2 if the Cancel button is clicked or the user presses Esc.