Results 1 to 5 of 5
  1. #1
    merlin777 is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    117

    combobox won't display concatenated fields

    I have a combobox in a form which I want to display/select a list of full names of a person. The names are currently in a table called tblnames which includes the fields, idnumber, firstname, lastname so somehow I have to concatenate the two name fields, display them in the combobox and select them so this can be used in a filter in a query (which also has these two fields concatenated into one 'fullname' field).



    i Tried putting this:

    =[tblnames]![FirstName] & [tblnames]![LastName]

    in the control source file of the combobox and the row source is set to 'tblnames' but the combobox just displays the first 4 columns of 'tblnames' (I set the column count to 4).

    So, why isn't this working and is there a better 'good practice' approach to achieve what I need?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    ControlSource: the field from the form RecordSource you want to save the selected ID into - however, if the combobox is used only to input filter criteria this property should be left empty, otherwise you change the value in record

    RowSource: SELECT IDnumber, LastName & ", " & FirstName AS FullName FROM tblnames ORDER BY LastName, FirstName;

    BoundColumn: 1

    ColumnWidths: 0";2.0"

    Really should use the IDnumber for filtering.
    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.

  3. #3
    merlin777 is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    117
    I'm only getting the lastname displayed (how come the order is lastname, firstname in the expression?)

    Also, for some reason when I click on something in the list to select it, it does not select and appear in the box.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Because most people search for a lastname before first name, so type into the combobox starting with last name. Or do whatever order you prefer.

    I forgot ColumnCount property, set it to 2, although it must already be set for the lastname to be showing.

    I don't know why the combobox fails. Would have to review your db.
    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.

  5. #5
    merlin777 is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    117
    Aha! I had the expression in the control source instead of the row source. Clumsy bugger.

    Solved both problems.

    Thanks!

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

Similar Threads

  1. Replies: 3
    Last Post: 04-09-2013, 09:32 PM
  2. Combobox display order
    By Duncan in forum Queries
    Replies: 91
    Last Post: 09-01-2011, 05:12 PM
  3. Combobox form display order
    By Duncan in forum Access
    Replies: 5
    Last Post: 08-23-2011, 05:17 PM
  4. Replies: 1
    Last Post: 03-24-2011, 07:09 AM
  5. Sum values in concatenated fields
    By jdrubins in forum Reports
    Replies: 4
    Last Post: 09-01-2009, 07:20 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