Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Setting up a combo box with multiple database columns

Posted on 2001-09-17
Last Modified: 2010-05-02
I need to use a combo box (and / or list box) that when you select the dropdown arrow, multiple database columns are listed. For example, an ID field, and a description field. But when you select a record, only one of the database columns would be bound to that control?
Question by:charming
  • 3
  • 2

Expert Comment

ID: 6487891
I am using sheridan combo to display colums.
why do need to display an id field?

Expert Comment

ID: 6487947
You can do it using Forms 2 component. Go to Components from Project menu and select Microsoft Forms 2 Object Library. I'll have a look to see if I have any code examples for you.

Expert Comment

ID: 6487975
According to Microsoft License Agreement you can not distribute Microsoft forms to users. Users must have Office installed.

Accepted Solution

uncle_med earned 85 total points
ID: 6487985
OK Charming

After selecting forms 2 from components. Create a forms2 combo on your form. Call it cmb. In it's properties make the columncount property 2 (You can do it through code). Then copy and paste this onto your form_load

Private Sub Form_Load()
    cmb.List(0, 0) = "R1C1"
    cmb.List(0, 1) = "R1C2"
    cmb.List(1, 0) = "R2C1"
    cmb.List(1, 1) = "R2C2"
End Sub

Let me know what you think

Expert Comment

ID: 6487999
rKot2000 is right

You must have Office installed to use forms2. I assume you have office installed.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
change vba from autofit to 13.5 width? 4 29
Validating VB6 Function 19 65
which modules are active in VB6 project? 6 39
Error with a code discussed on this page 5 29
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question