I have a good idea. When you do SQL statements in VFP, sometimes if the WHERE clause is "simple" to VFP, it will only set a filter on the table.
To avoid this, either use the NOFILTER clause and make sure in your WHERE clause you include AND NOT DELETED(), or add a dummy field to the result set to "trick" VFP into thinking the WHERE clause is not a simple statement:
First method:
SELECT wname,wday;
FROM workday;
INTO CURSOR tmp;
WHERE wday = date() ;
AND NOT wname="blank" AND Not Deleted();
NOFILTER
Second method:
SELECT wname,wday, .t. AS dummyfld;
FROM workday;
INTO CURSOR tmp;
WHERE wday = date() ;
AND NOT wname="blank"
>I have found the problem .
>
>When I check the value of reccount() :
>Select tmp
>i = reccount()
>
>It should be the total record of tmp ,right ?
>
>But in fact ,it give me the total record of workday .
>
>Do you know why ?
>
>>You could do one of several things:
>>
>>1.
>>Select tmp
>>Locate
>>Scan
>>
>>
>>>Firstly ,here is the source code :
>>>
>>>---------------
>>>thisform.list2.CLEAR
>>>
>>>SELECT wname,wday FROM workday WHERE wday = date() ;
>>>AND NOT wname="blank" INTO CURSOR tmp
>>>
>>>SELECT tmp
>>>FOR i = 1 to RECCOUNT()
>>>GO i
>>>thisform.list2.ADDITEM (tmp.wname)
>>>endfor
>>>
>>>RELEASE tmp
>>>---------------
>>>The problem is I can prove that there is no record in tmp ,but when I run the program ,it added 3 item into list2 ! HOW COME ?! It make me crazy .
>>>Do you have any idea about that ?
Travis Vandersypen