Results 1 to 8 of 8
  1. #1
    jmuirman1 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    84

    Showing first and last name after selecting choice in combo box

    I've seen solutions on line but just don't understand.



    I select the client and see the first and last name. but after selecting, i only see the last name. here is the row source:

    SELECT [tContacts].[Client ID], [tContacts].[CLastName], [tContacts].[CFirstName], [tContacts].[CClient] FROM tContacts ORDER BY [CLastName];

    Bound column is set to 1. when i change to 2, i just see the ClientID number.

    Thanks,

    John

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,421
    Code:
    SELECT [tContacts].[Client ID], [tContacts].[CLastName] & ", " & [tContacts].[CFirstName] as LastFirst, [tContacts].[CClient] FROM tContacts ORDER BY [CLastName]; 
    Try this.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,815
    I've seen solutions on line but just don't understand.
    A combo list can show as many columns (which usually refer to table or query fields) as you want but the control can only show a value from one column without concatenating multiple columns into one. In effect, that's still only one column - a single column of concatenated values from other fields. I figured I'd better elaborate on that or I'd get some disagreement. Also, the control can only be bound to one field and is a 1 based collection. Column(0) is available, but I rarely use it because it provides the list row index of the selected record.

    Bound column is set to 1. when i change to 2,
    This sounds like you are showing the ID column, which is usually not done. While the ID is often part of a combo, listbox, query etc. it's typically never shown to the user in order to avoid confusion and questions about it. In order to bind a combo selection of "Smith" to ID 55, the ID is the first field in the query or record set, it's column width is set to 0 so as to hide it, and the bound column is set to 1. The order of list columns will match the order of the query fields.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    jmuirman1 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    84
    how do i select the name but show the first and last?

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,421
    Quote Originally Posted by jmuirman1 View Post
    how do i select the name but show the first and last?
    What's the purpose of the combo box?
    To look up an existing record to show on the form?
    OR Enter the dropdown name into an existing record being currently shown on the form?

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,815
    Did you try the suggestion? Answer would be to use the sample row source sql provided.
    You'll see a column with first and last names together and select the pair that you want. In the list you could show last, first and the concatenated pair as 3 columns if that's what you're asking, but that doesn't make sense to me.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,951
    Combobox properties:

    RowSource: SELECT [Client ID], CLastName & ", " & CFirstName AS FullName, CClient FROM tContacts ORDER BY CLastName, CfirstName;
    ColumnCount: 3
    ColumnWidths: 0",1.5", 1.5"
    BoundColumn: 1
    ControlSource: name of field saving ID into if needed


    Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    jmuirman1 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    84
    perfect! that worked.

    thanks,

    John

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 09-14-2017, 02:24 AM
  2. Replies: 0
    Last Post: 03-20-2017, 12:36 PM
  3. Replies: 0
    Last Post: 03-19-2017, 01:29 PM
  4. Replies: 2
    Last Post: 10-21-2014, 07:57 AM
  5. Replies: 4
    Last Post: 10-22-2013, 11:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums