Share via

Display two fields in combo box

Anonymous
2012-11-21T12:21:34+00:00

I have a report form, that has a combo box, and when employees use the drop down it displays the ID and the username, however after it is selected the field just displays the ID, how can i get it to display the ID and Name?

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

5 answers

Sort by: Most helpful
  1. ScottGem 68,820 Reputation points Volunteer Moderator
    2012-11-21T13:03:16+00:00

    A Combobox will display ONLY the first non zero width column after selection. So you have a few choices. First, the ID is usually system generated and the user doesn't need to see it. If that is the case, then set the Column Widths property to 0";2" (or whatever width you need for the username). The user will only see the Username, but the ID will be stored.

    If that doesn't suit, then you could concatenate the two in your RowSource as Hans suggested, again setting the first column to zero width.

    Another solution is to have a text box with the ControlSource of:

    =combo.Column(1)

    This will display what is in the second column (count starts with 0) in the text box.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2012-11-21T15:31:22+00:00

    makes sense, thank you again.

    Was this answer helpful?

    0 comments No comments
  3. ScottGem 68,820 Reputation points Volunteer Moderator
    2012-11-21T14:41:43+00:00

    That will not work because you don't have that combobox on your report (or shouldn't). Your report should be based on a query. The query should be joining the table with your usernames to your main data table. You then add the Username column from that table instead of the ID column from your Main table. Then you can have a control assigned to Username.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2012-11-21T14:03:38+00:00

    Thank you, that worked for my form but how do I get the name display in the report now? I added the same control source ([Mold].Column but I get this "#Name?".....

    Was this answer helpful?

    0 comments No comments
  5. HansV 462.6K Reputation points
    2012-11-21T12:50:42+00:00

    You'd have to set the Row Source of the combo box to a query or SQL string that combines the ID and username. For example:

    SELECT ID, [ID] & " " & [UserName] AS DisplayName FROM MyTable

    Substitute the correct names for the table and the fields.

    Was this answer helpful?

    0 comments No comments