Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List box does not refresh in VFP 9
Message
From
22/09/2006 18:04:43
 
 
To
21/09/2006 01:15:24
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01155542
Message ID:
01156631
Views:
29
Hi Fabio,

I tried your suggestion, however, it did not solve the problem and I continue to get the error -- THIS can only be used within a method.

I did some experiments and found out the behaviour I am getting is due to SET EXACT and/or SET ANSI settings. When I use SET EXACT ON or SET ANSI ON or == operator, the list box displays correct information. I am gettting the same behaviour in VFP 6 as well as VFP 9 on the same PC. I have confirmed that This.Value is not empty and its length is 6, same as Orders.Cust_ID. Here is the code I used in VALID() of combo box.
*!*	* Problem: Always extracts all records even though This.Value is not empty 
*!*	*          and LEN(This.value) = LEN(Orders.cust_ID)
*!*	*  Form displays error: THIS can only be used within a method
SET EXACT OFF
SET ANSI OFF
SELECT order_id,order_date, order_amt, shipped_on FROM orders ;
    WHERE orders.cust_id = This.value ;
    INTO CURSOR curSelectedOrders ;
    ORDER BY order_id		

* This works 
*!*	SET EXACT OFF
*!*	SET ANSI OFF
*!*	SELECT order_id,order_date, order_amt, shipped_on FROM orders ;
*!*		INNER JOIN customer ON orders.cust_ID = customer.cust_ID ;
*!*	    WHERE orders.cust_id = This.value ;
*!*	    INTO CURSOR curSelectedOrders ;
*!*	    ORDER BY order_id    

* This also works ...
*!*	SET EXACT ON 
*!*	SET ANSI OFF 
*!*	SELECT order_id,order_date, order_amt, shipped_on FROM orders ;
*!*	    WHERE orders.cust_id = This.value ;
*!*	    INTO CURSOR curSelectedOrders ;
*!*	    ORDER BY order_id		&& Extracts correct records     


* This also works
*!*	SET EXACT OFF 
*!*	SET ANSI OFF 
*!*	SELECT order_id,order_date, order_amt, shipped_on FROM orders ;
*!*	    WHERE orders.cust_id == This.value ;
*!*	    INTO CURSOR curSelectedOrders ;
*!*	    ORDER BY order_id		&& Extracts correct records
     
* This also works 
*!*	SET EXACT OFF 
*!*	SET ANSI ON 
*!*	SELECT order_id,order_date, order_amt, shipped_on FROM orders ;
*!*	    WHERE orders.cust_id = This.value ;
*!*	    INTO CURSOR curSelectedOrders ;
*!*	    ORDER BY order_id		&& Extracts correct records     
I looked at the help of SET EXACT and SET ANSI, but could not understand the reason for SELECT retruning all records, particularly the form displaying error.

Has anyone seen something similar or any suggestions?
- Ravi Taxali
Visual FoxPro Made Simple An excellent book for beginners as well as experienced programmers
Never Forget Again. Setup Email Reminders.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform