Hi Graig,
>>>>We have SET EXCLUSIVE OFF and also open the tables with USE TABEL SHARED.
>>>RLOCK() should work the same way for both free and non-free tables. Try to check your code, maybe it's something wrong there.
>>You are correct. There was a error in the code. But we still have the problem. We have RLOCK()ed a record in a table (we use this on the USERS table so that we can know if the user is logged on or not). Then we USE the same table in another form which is Optimistic Table Buffered by another user (still with me :-)).
>>
>>We change the record which is RLOCK()ed with the other user. It just works without any errors (TABLEUPDATE(.T.) doesn't give a lock error). Then we logoff and logon anew. Then we edit the record again and we see that nothing has changed.
>>
>>Now the question. How do we get a error message with TABLEUPDATE() that the record is locked and can't be changed?
>
>You should not get errors if the record truely is RLOCKED(). I suggest you test things in the command window and see what your results are.
Well I tested it with the command window and it works fine. VFP just gives an error message that the current record cannot be locked and so it can't change a thing then. But with a optimistic table buffered form when we use TABLEUPDATE(.T.) it doesn't give an error message. While it should.
>As for checking if a user is logged on, there is an article on my web page that discusses limiting simultaneous logins. The same method can be used to check if a particular user is logged in.
Thanks alot for the pointer. But that's not the approach we are using. We just lock the record of the user who is logged in from the users table. That way we can also keep track.