BUG: ON ERROR Not Called When Update Conflict Occurs in Grid

Last reviewed: April 25, 1997
Article ID: Q148999
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a

SYMPTOMS

When you use row or table buffering in a form, an update conflict could occur if a user attempts to make changes to data that has already been updated by another user. In this situation, Visual FoxPro will display a standard update conflict error message, which allows the user to revert their changes. You can use an ON ERROR routine to trap for this error to more gracefully handle potential update conflicts. However, when you use an ON ERROR routine to trap for these update conflicts, the error routine will not be called correctly if the error occurs while interacting with a grid. This is a bug.

WORKAROUND

Using the Valid event of the text box object in the columns of a grid, you can check for potential update conflicts before actually performing the updates. Place the following code in the Valid event of the text box in every column of a grid:

   IF InList(GetFldState(This.ControlSource),2,4) AND ;
      OldVal(This.ControlSource)<>CurVal(This.ControlSource)
        WAIT WINDOW 'Value has been changed by another user.'
        =TableRevert(.t.)
        RETURN 0
   ENDIF

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Create a new form. Add a table to the data environment of the form and set the BufferModeOverride property to 3. Drag the table from the data environment to the form to create a grid. Save the form as Test.scx.

  2. Create a new program that contains the following code:

    SET EXCLUSIVE OFF ON ERROR WAIT WINDOW 'This is my error handler' DO FORM Test

  3. Save and run the program.

  4. Start a second instance of Visual FoxPro, and run the program under this second instance of Visual FoxPro.

  5. Make a change to a field on the first record in the grid, and move off that record to update the table.

  6. Switch back to the first instance of Visual FoxPro.

  7. Make a change to the same field on the first record of the grid, and move off that record to update the table. Note that the standard update conflict error appears instead of the WAIT WINDOW.

REFERENCES

For more information about the grid and the ON ERROR command, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q130131
   TITLE     : PRB: ON ERROR Not Called When Trigger Fails in Browse
               or Grid


KBCategory: kbnetwork kbbuglist
KBSubcategory: FxprgGrid vfoxwinbuglist3.00 buglist3.00b buglist5.00
Additional reference words: 5.00 3.00 3.00b multiuser
Keywords : buglist3.00 buglist3.00b buglist5.00 FxprgGrid vfoxwin vfpbug5.0a kbnetwork kbprg kbbuglist
Version : 3.0 3.0b 5.0 5.0a
Platform : WINDOWS
Issue type : kbbug


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 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.