Hi!
It looks like VFP use internal events system to notify all aliases opened in all workareas about changes made in relations and other things in tables that can affect something widely. When internal events are not processed, next lines then can fail or work incorrectly. Waiting state, WAIT WINDOW and similar commands that stop program execution and wait for user input also runs the internal events processing in VFP. To force running it in VFP without stopping program, tehre is a command DOEVENTS.
In addition, try instead of use DOEVENTS command put "_VFP.AutoYield=.T." line just before the code you running (before setting relation). DIEVENTS have a bug in VFP6 that cause this command work too slow. _VFP.AutoYield=.T. state cause similar thing - internal VFP events are processed between code lines.
What VFP version you use?
HTH.
>Replace the wait window by DOEVENTS makes it work! Thanks for the helps :)
>
>But why does it work with DOEVENTS? Does it mean it my original codes, VFP have not run the set filter command?
>
>Jimi
>
>>>Yeah, I'm sure I've selected the correct work area before I save it.. have to wait for tomorrow morning to test what Vlad suggested. What else do you think whould cause this problem?
>>
>>You can also try to put LOCATE right after set filter to (cFilter). It should move record pointer to the first record in the filtered set.
>>
>>>
>>>Jimi
>>>
>>>>Are you sure you're on the correct work area when you are saving filter expressen?
>>>>Try to add select MyTable before cFilter = filter().
>>>>
>>< snip >
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.