Thisform.lstOrders.Requery()>I created a simple form with a combo box (cboCustomer) and a list box (lstOrders). The combo box is used to select a customer ID from a customer table, and its valid event is used to load the orders for the selected customer from the Orders table. Here are the properties for cboCustomer and lstOrders. (The Customer and Orders table have been added to the Data Environment of the form. Data Session is default.)
* Define properties for the cboCustomer combo box >WITH Thisform.cboCustomer > .ColumnCount = 2 > .ColumnWidths = "200,0" > .ColumnLines = .F. > .BoundColumn = 2 > .RowSourceType = 3 && SQL Statement > .RowSource = "select company, cust_id from customer into cursor curCustomer" > .Style = 2 && Dropdown list >ENDWITH > >* Define Properties for the lstOrders list box >WITH Thisform.lstOrders > .RowSourceType = 2 && Alias > .ColumnCount = 4 > .ColumnWidths = "100,100,100,100" >ENDWITH >>The Valid() event of cboCustomer has the following code
Thisform.lstOrders.RowSource = '' >SELECT order_id,order_date, order_amt, shipped_on FROM orders ; > WHERE cust_id = This.value ; > INTO CURSOR curSelectedOrders ; > ORDER BY order_id >Thisform.lstOrders.RowSource = 'curSelectedOrders' >>The form runs fine in VFP 8. As soon as I select a new customer, the list box displays the orders for that customer in the list box. However, when I ran the same form in VFP 9 on some other computer, I see strange behaviour, e.g. list box disappears, list box does not refresh, list box appears when I click on the disappeared list box, etc. I added code to refresh the list box and/or the form, but it did not help.