Locked tables

Hi, is it possible check tables for lock state without running in an error by dblockfile(tablevar,false)? Any ideas? Thanks, Marc

Sure, What you need to do is create a function to test for the lock. In the Function you put: dbLOCKFILE(MyRec,FALSE); IF NOT dbFINDREC(MyRec,’-’) THEN; dbCOMMIT; And then you create a report to test for locks : IF CallFunction(999,Rec) = FALSE THEN //Table is locked

Hi Lennart, we tried the “dblockfile” in a function before. The ERROR which occures by dblockfile will abort the whole code without returning a value to the calling object. As far as I know the function will only return a value when using “ERROR” in your function-code. Marc

Hi Marc, It works fine for me ! When the function is called with IF callFUNCTION() the error-message isn’t shown, and the function returns FALSE so you can test if the table is locked.

Hi Lennart, I can’t believe it! You are right! I don’t know why it didn’t work when we tested a similar code. It seems that the code we tested wasn’t that similar at all… Is it important to use the if-clause and dbcommit? Thanks a lot! Marc