PRB: Numeric Value Not Written to Table from Text Box
Article ID: 138778
Article Last Modified on 2/10/2000
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
This article was previously published under Q138778
SYMPTOMS
When you place the insertion point in the middle of numerical field on a
form and press ENTER, the displayed value becomes the integer value of the
digits to the left of the insertion point. For example, if the displayed
field value is 12345.678, and you place the insertion point between the 2
and the 3 and press ENTER, the new displayed value becomes 12.000. However,
unlike the behavior when directly editing a table in FoxPro 2.6, the value
is not written to the table after you press the ENTER key.
WORKAROUND
A numerical field from a table added to a FoxPro for Windows, version 2.6
screen displays the truncated results and writes the changes to the table
as soon as you move off of the field. In Visual FoxPro, if you manually
change the field, the ControlSource updates and changes are written to the
table. To force Visual FoxPro to behave as FoxPro 2.6 does, you must either
use the REPLACE command or enable data buffering. Both methods are
discussed below.
Using the REPLACE Command to Edit the Table Directly
- Add a text box to a form, and set its ControlSource property to a
numerical field from a table.
- In the LostFocus event of the text box, add these commands:
REPLACE <fieldname> WITH This.Value
This.Refresh
Data buffering
- Set the BufferMode property of the form to either Optimistic or
Pessimistic buffering.
- Add a text box to a form, and set its ControlSource property to a
numerical field from a table.
- In the LostFocus event of the text box, add these commands:
REPLACE <fieldname> WITH This.Value
=TABLEUPDATE(.T.)
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
Additional query words: VFoxWin
Keywords: KB138778