
Referring to property within select statement in list/combo box rowsource
In that case try _screen.activeform.cs_val order
Best regards,
Tom
Quote:
>It doesn't like 'THISFORM 'THIS' OR 'THISFORMSET' - here at last vfp5.0a
>doesn't (or mine doesn't)
>nik
>>Hi Nik,
>>>Hi
>>>I am trying to use a conditional select statement to populate a listbox
>>>"select cls_id .. from .. where subject=this.parent.s_val order "
>>>you get the idea.
>>>Using the above gets you the error 'This,Thisformset,Thisform can only be
>>>used within a method'
>>>Ok you can use a public variable but this is Messy!!! I don't like too
>many
>>>public variables in the system - since this is a class it can have more
>>than
>>>one instance on a form!!
>>>I have tried creating a reference to the property in the init method of
>the
>>>listbox e.g. reftopar=This.parent and use 'subject = reftopar.s_val' in
>the
>>>select. at least multiple instances will use the correct value This works
>>if
>>>the variable is public but until this reference is released any form
>>>containing the control is not closed. I tried putting the 'release
>>reftopar'
>>>in the destroy method of the listbox but this doesn't fire until after
the
>>>reference is released - i think the destroy(destructor) methods fire from
>>>out to in.
>>>I assumed that whenever the listbox is populated that the requery method
>>was
>>>used and so I defined the reference in the requery method called the
>>parents
>>>requery and destroyed the variable but when it ran the SQL_column not
>found
>>>error appeared before the requery method was called - does FoxPro use a
>>>different method to populate the box initially?
>>>Which method is best (of the ones that work) Am I missing something
>obvious
>>>here ??
>>Create a Form-level property - cs_valorder and give it a default value.
>>In your list box, the SQL would be:
>>SELECT cls_id .. from .. where subject=thisform.cs_val order
>>Best regards,
>>Tom