Results 1 to 11 of 11
  1. #1
    ThebigCt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    22

    2 Column Combo Boxes in display.


    I have it set up so in the combo box drop down that it shows both columns that I want displayed but when an option is chosen, only the first column shows up in the box. I need both to show up.. I searched the forms and found a few things but I still wasnt able to complete it. Any tips?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    A combobox will show only one column. If you want more than one field to show in the box, construct a column that concatenates fields into one string. Like:

    SELECT ID, ID & " | " & fieldname As somename FROM tablename;
    Last edited by June7; 02-22-2012 at 04:05 PM.
    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
    ThebigCt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    22
    Thanks June7. Where would enter this equation?

    SELECT ID, ID & " | " & fieldname As somename FROM tablename;

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use the example I gave as the RowSource for combobox. Use your field and table names in place of the generic aliases. In place of 'somename' use whatever you want.

    Concatenation is really useful for situations like:

    SELECT ID, LastName & ", " & FirstName As EmpName FROM tblEmployees;
    SELECT ID, Address & ", " & City & ", " & State & " " & Zip As CustAdd FROM tblLocations;

    Review tutorials at http://datapigtechnologies.com/AccessMain.htm especially the 3 on comboboxes in the Access Forms: Control Basics section. I don't think they show the concatenation technique but should find other stuff of interest.
    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
    ThebigCt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    22
    SELECT Position_Name & " | " & Organization_Name As Internship_1_Name FROM Student;

    Does this look correct, if I'm trying to get my combo box display to look like :

    Event Manager | Entertainment Inc

    If event manager is the position name and Entertainment Inc is the organization name?

    If that is correct where do I enter the equation?

    Thanks.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Not quite. I expect you need the unique ID field included as shown in the examples.

    The SQL SELECT statement goes in the RowSource property of the combobox. Then set other properties:

    ColumnCount: 2
    BoundColumn: 2
    ControlSource: ID (only if this is a bound control and use whatever your unique ID fieldname is)
    ColumnWidths: 0";2"
    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.

  7. #7
    ThebigCt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    22
    That website is very helpful. I'm going to attach my database so you can see where I am talking about.
    On the form: Student
    On the combo box: Field Experience
    This combo box is a conditional box using a query as a row source for the Semester and the year. so I am a bit confused on how I should tackle this one.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No attachment to your post.
    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.

  9. #9
    ThebigCt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    22

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    RowSource for FieldExperience combobox is to restrict list to positions that are field category and available during the year selected in another combobox? Since should be saving the pk Practicum_ID, not PositionName, need to include Practicum_ID in the RowSource. Same goes for the other Experience fields. Means the comboboxes must be multi-column. One of the tutorials I referenced previously shows that. Alternative is the Position_Name field is made the pk. So fix tables and relationships or fix comboboxes.
    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.

  11. #11
    ThebigCt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    22
    I got it figured out. Thank you.

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

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Replies: 1
    Last Post: 12-08-2011, 08:03 AM
  3. Combo Boxes always display first record of table
    By LilMissAttack in forum Forms
    Replies: 4
    Last Post: 08-12-2011, 11:36 AM
  4. Total of column with check boxes
    By turbosdad in forum Queries
    Replies: 4
    Last Post: 08-07-2010, 07:03 AM
  5. Replies: 1
    Last Post: 03-27-2010, 06:13 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