[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Setting up a combo box with multiple database columns

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?
0
charming
Asked:
charming
  • 3
  • 2
1 Solution
 
rkot2000Commented:
I am using sheridan combo to display colums.
why do need to display an id field?
0
 
uncle_medCommented:
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.
0
 
rkot2000Commented:
According to Microsoft License Agreement you can not distribute Microsoft forms to users. Users must have Office installed.
0
 
uncle_medCommented:
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.AddItem
    cmb.List(0, 0) = "R1C1"
    cmb.List(0, 1) = "R1C2"
    cmb.AddItem
    cmb.List(1, 0) = "R2C1"
    cmb.List(1, 1) = "R2C2"
 
End Sub

Let me know what you think
0
 
uncle_medCommented:
rKot2000 is right

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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now