M
Mel P
There is undoubtably a better way to do it but here is
what I have done and what my problem is.
I have generated an ADO recordsetset (rst). I want to use
this to populate a list box. I set the list box
RowSourceType to value list. If I try to assign values
inside the loop with;
Do Until rst.EOF
lstBox.RowSource = rst!ID ";" & rst!Item & ";"
rst.MoveNext
Loop
This works BUT each row in the list box is the first row
and is overwritten at each visit, so I only get one row of
the final value!
If I create an array of the ID and Item values, in this
loop and then concatenate the values to make a long string
of pairs of the values with ";" separators and then make
this string the RowSource, this works - the list box is
populated. I can then select a value etc..
What have I missed please - how can I populate a list box
from an ADO recordset. (I know I can populate the listbox
from a query but I would like to know if I can do it this
way. Any suggestions welcome. Thanks
Mel P
what I have done and what my problem is.
I have generated an ADO recordsetset (rst). I want to use
this to populate a list box. I set the list box
RowSourceType to value list. If I try to assign values
inside the loop with;
Do Until rst.EOF
lstBox.RowSource = rst!ID ";" & rst!Item & ";"
rst.MoveNext
Loop
This works BUT each row in the list box is the first row
and is overwritten at each visit, so I only get one row of
the final value!
If I create an array of the ID and Item values, in this
loop and then concatenate the values to make a long string
of pairs of the values with ";" separators and then make
this string the RowSource, this works - the list box is
populated. I can then select a value etc..
What have I missed please - how can I populate a list box
from an ADO recordset. (I know I can populate the listbox
from a query but I would like to know if I can do it this
way. Any suggestions welcome. Thanks
Mel P