FIX: Clicking Scroll Bar in Grid Writes Data to Wrong Record
Article ID: 139196
Article Last Modified on 9/30/2003
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 3.0b Standard Edition
This article was previously published under Q139196
SYMPTOMS
If you create an edit box in a grid column, enter data in that edit box,
and then click the scroll bar of the grid without exiting the edit box, any
of the following may occur:
- Data may be written to the wrong record.
- Data may be lost.
- Record locking errors may occur.
- Data may be truncated.
CAUSE
The edit box does not close automatically when it loses the focus to the
scroll bar. In some cases, it acts as if it were never open. In other
cases, it acts as if it were open on the record to which the record pointer
moved. Odd behavior may occur if the control source of the edit box is set
to either a character field or a memo field. These behaviors do not occur
if you click another cell in the grid or click an object outside the grid.
WORKAROUND
Trap for the MouseDown event while in the edit box. This can be done by
placing the following code in the MouseDown event of the grid, which fires
before the Scroll event fires:
IF this.activecolumn = 2 && or whatever column the edit box is in
keyboard '{TAB}' && or SHIFT-TAB
ENDIF
This forces the edit box to close properly before the scroll can be run.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. This problem has been fixed in
Visual FoxPro 5.0 for Windows.
Additional query words: kbVFp300bug kbVFp300abug kbVFp500fix kbDSupport scrollbar
Keywords: kbbug kbfix KB139196