Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Display multiple Columns In Combo Box

Posted on 2012-09-07
6
Medium Priority
?
630 Views
Last Modified: 2012-09-07
I have a combo box whose row source is:

Company
LastName
FirstName

Column Bound is 1

When the user selects the pull down I want to display all three columns.
0
Comment
Question by:seamus9909
6 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38376294
YOu can display all 3 columns in the drop down list but once you have made a selection you will only see the first column displayed in the textbox part of the combo.  You cannot change that.

To see other values from the combo you should add unbound textboxes to the form and then use the afterupdate event procedure of the combo box to fill them.

Me.textbox1= me.comboboxname.column(1)   ' Lastname
Me.textbox2= me.comboboxname.column(2)   ' Firstname

Note that when using VBA code the first column is column(0)
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38376302
You can display all column in the dropdown list by adjusting the column count and width properties accordingly, but you can only display one column in the textbox portion.

If your bound column is an ID and you want to display text, set the column width of the bound column to zero and the textbox portion of the combo will display the next column with a non-zero width.

To display multiple fields from your combos selected row however, you would need to set up textboxes for these values and set their respective control sources to:

= cboYourCombo.Column(0)
= cboYourCombo.Column(1)
= cboYourCombo.Column(2)
= cboYourCombo.Column(3)

etc (zero based column count)...


EDIT:

I cross posted with Pete.  There may be some additional information in this comment, but it largely duplicates what he already posted.
0
 
LVL 20

Accepted Solution

by:
clarkscott earned 2000 total points
ID: 38376363
You may want to edit the dropdown properties: Column Count, Column Headings (yes/no), Column Widths,  and LIST WIDTH.  
Column Count: 3
Column Headings: Yes
Column Widths: 2"; 2";1"
List Width: 5"  (add the column widths values)

Scott C
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:seamus9909
ID: 38376462
Yes I don't need to create any additional text boxes I just want the user to be able to see

the  Company Name
       FirstName
       LastName

before making their selections.


So the row source

CompanyId
CompanyName
FirstName
LastName

Scott what would the values for the pulldown be The CompanyID shoud not be visible
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 38376502
Width = 0"
Make sure your column widths match the order of the columns in your recordsource (for the combo).
If ID is the first column, then
Column Widths:  0";2";2";2"

Scott C
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 38376510
Make sure the List Width adds up to the column widths.... 0 + 2 + 2 + 2 = 6"
or else they will be there.... but you won't see them.

Scott C
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

810 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