Hi Afier ---
The problem is that the variable goes out of scope when any control or other PEM is bound to that table. The way to solve it is to use a Class (I am assuming Form?) property for the FILTER value -or- (I don't recommend this but it works) a PUBLIC variable.
>
>I am using Visual FoxPro 6.0. I have created a class with a listbox on it which uses a table. I want to set a filter on it which is given by another method outside the class using a parameter. Now I am using the next code:
>
>LPARAMETER mFilter && mFilter = 'value'
>
>USE table IN 0
>SELECT table
>SET FILTER TO table.field = '&mFilter'
>
>This is working.
>
>But now I don't want to define the table.field in the class. I have tried the next code, but that does not work.
>
>LPARAMETER mtable, mFilter && mFilter = "table.field = 'value'"
>
>USE mtable IN 0
>SELECT mtable
>SET FILTER TO mFilter
>
>This code is not working because FoxPro can not find variable mFilter.
>When I use a WAIT WINDOW to display the value of mFilter the value is right.
>
>Can anyone help me with this problem? Thank you in advance.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05