Share via

display multiple values in combo box access

Anonymous
2011-05-02T04:08:32+00:00

I am trying to show multiple fields in my combo box on my form.  When I click the drop down arrow is shows both columns, however after selection only the information from the first column is displayed.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-05-02T16:57:58+00:00

For an example of the solution suggested by Tom you might like to take a look at my demo file at:

http://community.netscape.com/n/pfx/forum.aspx?nav=libraryMessages&tsn=1&tid=23626&webtag=ws-msdevapps

The demo is principally intended to show how to use 'correlated combo boxes', i.e. where the selection in one combo box restricts the selection in another and so on down the line, but it does include a form, opened from the 'Open Form in Continuous Form View Using Multi-Column Combo Box and Text Boxes' button on the opening form, which shows the values of three columns after selection from a combo box.

One thing to note when doing this is that the Column property is zero-based, so Column(1) is the second column from a combo box's RowSource, and so on.

This method is more appropriate where the columns represent disparate attribute types.  Where they are separate elements in a combined attribute, as in Karl's example, concatenating the values into a single column is often a better solution, e.g. for a combo box bound to an EmployeeID column you might set it up as follows:

RowSource:     SELECT EmployeeID, FirstName & " " & LastName FROM Employees ORDER BY LastName, FirstName;

BoundColumn:   1

ColumnCount:   2

ColumnWidths:  0cm;8cm

If your units of measurement are imperial rather than metric Access will automatically convert the last one.  The important thing is that the first dimension is zero to hide the first column and that the second is at least as wide as the combo box.

The above would list the employee names alphabetically by last then first name, in the format Ken Sheridan, and show the selected employee name in the same format.

Was this answer helpful?

30+ people found this answer helpful.
0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2011-05-02T04:22:45+00:00

    You could have another field and set its ControlSource property to:

    =myCombobox.Column(1)

    Was this answer helpful?

    5 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2011-05-02T14:29:09+00:00

    Edit - after some reflection, it is possible to display multiple values in a combo box if you use multi-value fields in databases in the .accdx format, but most developers discourage the use of such fields.

    Mutliple VALUES yes, multiple FIELDS (as was the question) is where your original answer was correct. :-)

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2011-05-02T13:24:22+00:00

    That behavior is by design - combo boxes only show a single value unless you drop them down.  To display multiple fields, you need to either use a list box, or a subform.

    Edit - after some reflection, it is possible to display multiple values in a combo box if you use multi-value fields in databases in the .accdx format, but most developers discourage the use of such fields.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2011-05-02T15:38:44+00:00

    For multiple fields create a calculated field like this --

    [Title] & "  " & [FName] & "  " & [LName]

    Was this answer helpful?

    0 comments No comments