BUG: ON ERROR Not Called When Update Conflict Occurs in Grid
Article ID: 148999
Article Last Modified on 5/7/2003
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 3.0b Standard Edition
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 5.0a
- Microsoft Visual FoxPro 6.0 Professional Edition
This article was previously published under Q148999
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.
REFERENCES
For more information about the grid and the ON ERROR command, please see
the following article in the Microsoft Knowledge Base:
130131 PRB:
ON ERROR Not Called When Trigger Fails in Browse or Grid
Additional query words: multiuser kbvfp300 kbvfp500 kbvfp600
Keywords: kbbug kbnetwork kbprogramming KB148999