Microsoft KB Archive/274011

= BUG: SET(&quot;FILTER&quot;) Converts Dates to Current Date Format =

Article ID: 274011

Article Last Modified on 10/16/2002

-

APPLIES TO


 * 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 Q274011



SYMPTOMS
If you set a filter on a table involving a date field and then use the SET(&quot;FILTER&quot;) function to see the filter, the date is converted according to the current SET DATE setting. This is particularly likely to cause problems if SET STRICTDATE is set to 1 or 2 in Visual FoxPro version 6.0. This behavior also applies to the FILTER function.



RESOLUTION
The following code saves and restores the filter properly: *!* Save the current filter lcSetDate = SET(&quot;DATE&quot;) lcSetMark = SET(&quot;MARK&quot;)

SET DATE TO YMD SET MARK TO &quot;-&quot;

lcSetFilter = SET(&quot;FILTER&quot;) lcNewSetFilter = STRTRAN(lcSetFilter, &quot;{&quot;, &quot;{^&quot;)

SET DATE TO &lcSetDate SET MARK TO &quot;&lcSetMark&quot;

SET FILTER TO &lcNewSetFilter
 * !* Restore the old filter



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
To view the problem, run the following code in a .prg file: CREATE TABLE datetest (dField D)

FOR i = 1 TO 10 INSERT INTO datetest VALUES ({^2000-09-28} + i) ENDfor

SET FILTER TO dField = {^2000-10-04}


 * !* Displays the problem under VFP6 only
 * !* SET STRICTDATE TO 2
 * !* lcFilter = SET(&quot;FILTER&quot;)
 * !* SET FILTER TO &lcFilter

lcSetDate = SET(&quot;DATE&quot;) SET DATE TO MDY lcFilter = SET(&quot;FILTER&quot;) SET DATE TO DMY
 * !* Displays the problem under both VFP5 and 6 -
 * !* interprets date as April 10th

SET FILTER TO &lcFilter

SET DATE TO &lcSetDate

Keywords: kbbug kbvfp500afix kbxbase kbcodesnippet kbpending KB274011

-

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

© Microsoft Corporation. All rights reserved.