Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to populate multi-column combo box from deliminated string?

Status
Not open for further replies.

teddyatjorundotnet

Technical User
Dec 17, 2003
14
US
Howdy folks,

I'm in a bit of a quandry trying to figure this one out.

Basically I have a comma deliminated string that I need to use to populate a multi-column combobox. I'm confused because passing a comma deliminated string works properly for populating a listbox, and combo boxes are SUPPOSED to display the same behavior as a listbox in that respect.

So say I have a combo box with the following format:

3 columns
0;1.5;1.5 for widths
Bound to column 1

Then I want to pass the following values into the 3 columns:

5
Some Company
Some City

The values come from the following string:

"5","SomeCompany","SomeCity"

In an ideal world, I would love if there was a way to simply "locate" a record within the current recordset for the listbox. I see no such method though, so I think I'm stuck.

Other options I've considered is creating a temporary dataset and binding the control to that set, but I don't know if that's possible.

Is there a route that I haven't considered yet that would be feasable?

If it helps, the context of my request is to retrieve a users stored parameter preferences for a given report. In this case, it would be an ID field, a name (company, or entity) and a city. I make user preferences available to be stored and retrieved as some of the reports are HIGHLY parameterized and the users were starting to complain about constantly needing to recreate a set of preferences, while still complaining about lack of flexibility.

I'm pretty stuck on this one, any input would be greatly appreciated.
 
Make sure that the Row Source Type of the combo box is set to "Value List". Then you can set the RowSource to the comma delimited string.

Alternatively, you can set the RowSource to "Table/Query". Then you can set the RowSource to a query string.
 
Thanks for your reply!

I found the way around my issue, and as usual it was rediculously simple. Yet another case of trying to to pound a nail with an anvil.

If the combobox is already bound to a query, programmatically setting it's value to one of the currently bound values causes the box to scroll appropriately.

Learn something new everyday.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top