Trying to update a combo box...

D

David Lozzi

Hello,

I am trying to populate a combobox from the script. The data that is being
populated is being pulled from another database (IBM universe). We can pull
the data great and do whatever we want with it, like loading it into a
recordset, but then we cannot get the loaded recordset into the combo box.
Here's what I tried:

val = rst.GetString(adClipString, , ";", ";")
Me.Combo0.RowSourceType = "Value List"
Me.Combo0.RowSource = val

Where rst is the loaded recordset. The issue here is that the amount of data
we are pulling exceeds the length of the Value List.

How can I get this data into the combo box? I'm not married to the recordset
idea, i'd rather loop through the data from the other database and populate
the combobox immediatly. Is there a add row option?

thanks,
--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
www.delphi-ts.com
(e-mail address removed)

I should've known that, but I had a brain fart...
 
D

Dirk Goldgar

David Lozzi said:
Hello,

I am trying to populate a combobox from the script. The data that is
being populated is being pulled from another database (IBM universe).
We can pull the data great and do whatever we want with it, like
loading it into a recordset, but then we cannot get the loaded
recordset into the combo box. Here's what I tried:

val = rst.GetString(adClipString, , ";", ";")
Me.Combo0.RowSourceType = "Value List"
Me.Combo0.RowSource = val

Where rst is the loaded recordset. The issue here is that the amount
of data we are pulling exceeds the length of the Value List.

How can I get this data into the combo box? I'm not married to the
recordset idea, i'd rather loop through the data from the other
database and populate the combobox immediatly. Is there a add row
option?

In later versions of Access there's an AddItem method, but as far as I
know this is still based on the "Value List" RowSourceType, so I think
it's still too limited for you. But you should be able to use a
user-defined function for the RowSourceType. Such a function must be in
a very special format, which is laid out in the help topic,
"RowSourceType Property (User-Defined Function) - Code Argument Values".
See also the help topic for the "RowSourceType Property".
 
A

Albert D. Kallal

Any combo box with more then 100 or so is not really a good UI.

however, as mentioned, you can pull the data to an array, and them map that
array to the combo box in real time using a call function. Performance is
excellent, and there is not the limit size of the delimited string approach
(I would ONLY use the string approach for maybe 20, or 50 entries. After
that, you need different approach.

Check out the help, and also the following link on using the call back
function:

You could also use a temp table, but we all know that using temp tables
should be avoided at all costs, and in this case, thus the extra effort in
using call back function makes perfect sense..as temp tables are a evil
enemy.

Check out:

http://www.mvps.org/access/forms/frm0049.htm
 
D

Dirk Goldgar

Albert D. Kallal said:
Any combo box with more then 100 or so is not really a good UI.

however, as mentioned, you can pull the data to an array, and them
map that array to the combo box in real time using a call function.

I don't know if you necessarily *have* to use an array. Mr. Lozzi could
conceivably just use a static or module-level recordset, and navigate
through it as the callback function is asked for each row value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top