Microsoft KB Archive/319282

= FIX: SETFLDSTATE Does Not Work for Field with Default Value =

Article ID: 319282

Article Last Modified on 5/1/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q319282



SYMPTOMS
When you append a blank record to a table that has a default value in one of the fields, and you use the SETFLDSTATE function to make it appear that the value in that field has not been modified, GETFLDSTATE shows that SETFLDSTATE did not reset the field state.



RESOLUTION
To resolve this problem, obtain the latest service pack for Visual FoxPro for Windows 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

316964 How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows 7.0.

This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.



Steps to Reproduce the Behavior
Run the following code in Visual FoxPro 7.0 build 9262 to observe the behavior. CLEAR SET SAFETY OFF DELETE FILE TestDBC.* DELETE FILE TestTable.* CREATE DATABASE testDBC CREATE TABLE testTable (cField1 C(10) DEFAULT 'x', ;     cField2 C(10) )
 * Delete old database and table.
 * !* Create database, and table with default value.

SET MULTILOCKS ON CURSORSETPROP(&quot;Buffering&quot;,5)

APPEND BLANK
 * !* 4 for the changed default value.

? &quot;GetFldState: &quot; + STR(GETFLDSTATE(&quot;cfield1&quot;))

? SETFLDSTATE( 1, 3 )
 * !* This should tell VFP that the default has not been changed.

? &quot;GetFldState: &quot; + STR(GETFLDSTATE(&quot;cField1&quot;))
 * !* However, observe that SETFLDSTATE was ignored.

TABLEUPDATE(1) CLOSE DATABASES ALL
 * !* Clean up

Examine the results that appear on the desktop. The second GETFLDSTATE function returns 4, which indicates that the field has been modified. However, the SETFLDSTATE function marks the appended record as unmodified. The SETFLDSTATE function is effectively ignored.

Keywords: kbbug kbfix kbvfp700sp1fix kbcodesnippet kbdatabase KB319282

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.