>Hello all;
>I have a form with two combo boxes. Data sourse for the first combo box is set to a field in a parent table. What I'm trying to do is to set the data source of the second combo box to be a query result, based on the selection of the first combo box. So far I tried including a SELECT INTO ARRAY statement in the 1st combo box's VALID property, but for some reason the array size is not properly adjusted appropriatly (I thought this is suppose to happen automaticly).
>I also tried setting the RowSourceType to SQL Statement, and can't get that to work either ....
>
>Any ideas what I can try from here??
>
>
>Thanx in advance
>
>Kia
Kia,
In the requery method of the second combo put the following code;
SELECT ... FROM ... WHERE Field = THISFORM.Combo1.Value INTO CURSOR MyResult
THIS.RowSourceType = 2
THIS.RowSource = "MyResult"
THIS.Refresh()
That should solve your problem. The reason you are having a problem is that the
valid event of the first combo runs, it creates an array and then it ends and the array goes out of scope and disappears. Your second combo can't see the array that the first combo built. The solution I recommended is using a cursor and the building of the list for the second combo is IN the seocnd combo and not some other object.