>I am using the vfp 5.0 and i have two combo box which is related.
>for example :
>
>In the combo1.valid(), i have a code
> TRNLST=SYS(2015)
> THISFORM.COMBO2.COLUMNCOUNT = 2
> THISFORM.COMBO2.ROWSOURCETYPE = 3
> THISFORM.COMBO2.RowSource = "SELECT PRODUCTID+PRODCOLOUR AS RODUCTID,DESCRIPTION FROM PRODUCT WHERE PRODUCT.CUSTOMERID = THISFORM.COMBO1.VALUE ORDER BY PRODUCTID INTO CURSOR (M.TRNLST)"
>THISFORM.COMBO2.Value = THISFORM.CBOPRODUCTID.ROWSOURCE
>
>therefore my combo2 will list all the product which is from combo1. Yes it is done what i have asked. But the thing is when i close the form and reopen it i have to click the combo1 first then my combo2 list the products.
>
>Anyone can help me on this. I really appreciate that . thanks for helping me.
Firstly, such code is better placed in Combo1.InteractiveChange event. If you want to populate second combo from Form.Init event, you call it directly from there: This.Combo1.InteractiveChange().
There are few more problems: it's better to populate combo from cursor, you need to fire Combo.Requery after each SQL, etc.
Edward Pikman
Independent Consultant