Referring to property within select statement in list/combo box rowsource 
Author Message
 Referring to property within select statement in list/combo box rowsource

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 ??

Nik



Wed, 27 Jun 2001 03:00:00 GMT  
 Referring to property within select statement in list/combo box rowsource
Hi Nik,

Quote:

>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



Wed, 27 Jun 2001 03:00:00 GMT  
 Referring to property within select statement in list/combo box rowsource
It doesn't like 'THISFORM 'THIS' OR 'THISFORMSET' - here at last vfp5.0a
doesn't (or mine doesn't)

nik

Quote:

>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



Thu, 28 Jun 2001 03:00:00 GMT  
 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



Fri, 29 Jun 2001 03:00:00 GMT  
 Referring to property within select statement in list/combo box rowsource
Thanks - didn't think of that
Nik


Quote:
>In that case try _screen.activeform.cs_val order

>Best regards,
>Tom



Sat, 30 Jun 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Referring to property within select statement in list/combo box rowsource

2. SQL statement too long for RowSource property....

3. SQL statement too long for RowSource property....

4. Appropiate event for reruning a combos rowsource′s SQL-statement

5. List boxes in VFP 6.0 - selected property won't set in form's init

6. Query as rowsource in combo list

7. referring to combo box columns

8. Combo Box with style property set to dropdown combo

9. SQL RowSource for List Box in VFP 5.0A

10. Combo boxes with rowsource 2

11. SQL RowSource For List Box in VFP 5.0A

12. Adding a Heading for Combo/List box Drop Down list

 

 
Powered by phpBB® Forum Software