Fill Combo Box From Array?

  • Thread starter Thread starter Bill Sturdevant
  • Start date Start date
B

Bill Sturdevant

I have a function that returns an array -- a list of
subfolders (names of subfolders delimited by a linefeed).
I would like to use the array as a rowsource for a combo
box.

What is the best way to do it?
 
1>
You can concatenate the strings into one long string with ; separators, then
use that as the rowsource for the combo box.
You will have to handle the sorting in code.

2>
In Access 2002 you can use the Additem method on each array element to do
the same thing.
Still have to sort in code.

3>
You can create an empty temporary table, fill it with the array as records,
then run a query sorted how you like on the temp table, and use that as the
rowsource for the combo box.
Be aware that deleteing and recreating the temp table will increase the size
of your database until you do a 'compact and repair'.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
Am I to assume you have a list files in the array, and you want to send that
you a combo box?

Or, you mentioned linefeeds? Does that mean you have perhaps a string that
is delimited by linefeeds? The mention of linefeeds here is confusing.

Or perhaps, you have an array where each element is a folder, and thus for
each element of the array, the string is delimited for each file by a
linefeed?

You might want to clarify what you mean by linefeeds here, and how they fit
into the array you have.

If the results is only going to be 50, or perhaps max 100 files, then I
would consider using a delimited string and use a value list for the combo
box. If the array is going to on average have more then 100 files, then you
*might* hit the max char length of a value list (4000 characters). (100
files of 40 chars would hit the max quite fast).

You can also map the contents of the array to a combo box by using a call
back function. This would save the creating of the string. However, it
really depends on how you answer the above questions.

You can also write some code to sort the array also.
 
Back
Top