Ok. When a user lock a record, you write his username in a temporary table. Then, when the program can´t open the record or file, goes to the table and check who is the user. I don´t know about an specific function for do that, then I had to handle in that way....
By two common phrases in his vocabulary, we know Hercule Poirot was a great Developer: his use of "the little grey cells" and "order and method".