DOCUMENT:Q188064 11-DEC-1999 [foxpro] TITLE :PRB: ISRLOCKED() and ISFLOCKED() Return Incorrect Values PRODUCT :Microsoft FoxPro PROD/VER:WINDOWS:5.0,5.0a OPER/SYS: KEYWORDS: ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a ------------------------------------------------------------------------------- SYMPTOMS ======== When an instance of Visual FoxPro locks a record or a table, calling the ISRLOCKED() or ISFLOCKED() functions on another computer or another instance of Visual FoxPro returns false. RESOLUTION ========== Test the lock status using RLOCK() or FLOCK() instead. ISRLOCKED() and ISFLOCKED() only indicate whether the record or file is locked by the instance of Visual FoxPro from which they are called. If these functions were to test for the record and file locks of other users, the lock status could quickly change. This would make the information returned by ISRLOCKED() and ISFLOCKED unreliable. STATUS ====== This behavior is by design. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Save the following code in a program and run the program: *-- Code begins here. CREATE TABLE locktest (field1 C(10)) CLOSE DATA USE locktest SHARED INSERT INTO locktest (field1) VALUES ("A test") GOTO 1 =RLOCK() *-- Code ends here. 2. On another computer or in another instance of Visual FoxPro, save the following code in a program and run the program: *-- Code begins here. USE locktest SHARED GOTO 1 IF ISRLOCKED() WAIT WINDOW "Record is locked." ELSE WAIT WINDOW "Record is not locked." =RLOCK() && Should get the "Attempting to lock..." in status bar ENDIF *-- Code ends here. If you run the program from another computer, please map a drive to the first computer containing the Locktest table. After you run the second program the Wait Window appears. Press any key and the "Attempting to lock..." message appears in the status bar. REFERENCES ========== (c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Mike Stewart, Microsoft Corporation Additional query words: kbDSupport kbDSE vfoxwin ====================================================================== Keywords : Technology : kbVFPsearch kbAudDeveloper kbVFP500 kbVFP500a Version : WINDOWS:5.0,5.0a Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1999.