PRB: SET REPROCESS and ON ERROR Routines; "Attempting to Lock"

Last reviewed: April 29, 1996
Article ID: Q98920
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a

SYMPTOMS

The automatic locking commands call an ON ERROR routine depending upon the setting of SET REPROCESS, but the manual locking commands do not call an ON ERROR routine.

When SET REPROCESS is set to 0 (the default), an ON ERROR routine will be called when you attempt to lock a record or file instead of the error message "Attempting to Lock...Press escape to cancel" being generated.

If SET REPROCESS is set to AUTOMATIC or -2 and the initial lock fails, the system message "Attempting to Lock...Press escape to cancel" will be displayed. When ESC is pressed, the ON ERROR routine is called.

When manual locks [LOCK(), FLOCK(), RLOCK()] are used, if SET REPROCESS is set to 0, the system message "Attempting to Lock...Press escape to cancel" is not displayed and the ON ERROR routine is not called.

If SET REPROCESS is set to -2 and manual locking commands are being used, the system message "Attempting to Lock...press escape to cancel" will be displayed. If ESC is pressed, the ON ERROR routine will not be called. The manual locking commands do not call an ON ERROR routine because they simply return a logical .T. or .F. value indicating whether the file is locked or not.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start two sessions of FoxPro running on a single machine, either in Windows or another multitasking environment, or run it on two different machines on a network.

  2. Issue the SET EXCLUSIVE OFF command in both sessions.

  3. Issue the SET STATUS ON command in both sessions.

  4. Open a .DBF file and browse it in the first session of FoxPro and then type something in the first record so that the status bar shows the record as locked. Then open the same .DBF file in the second session of FoxPro and try to type something in the same record that is currently locked.

  5. To create an ON ERROR routine, type the following in the Command window:

          MODIFY COMMAND test
    

  6. In the Test program window, type:

          WAIT WINDOW
    

  7. Press CTRL+W to save the program.

  8. To execute the ON ERROR routine, type the following in the Command window:

          ON ERROR DO test.prg
    

  9. Repeat steps 1-4 to reproduce with the problem the ON ERROR routine active.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a err msg
errmsg
KBCategory: kbprg kberrmsg kbprb
KBSubcategory: FxprgBrowse


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.

Last reviewed: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.