Results 1 to 7 of 7
  1. #1
    bar891 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    20

    populate combo box from table


    I'm trying to use a combobox as a filter for a search page. I want to populate the list in the combobox from a table but i have multiple entries that are the same. I only want one of each different entry in the combo box. what is the best way to filter this ?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Use Select DISTINCT in the combo rowsource sql.

  3. #3
    bar891 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    20
    i tried that but it didn't work

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    'didn't work' doesn't help us to help you. What error did you get? or was it a wrong result? if so, what was wrong with it?

    What is the sql to the rowsource you used that 'didn't work'?

  5. #5
    bar891 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    20
    This is what i used as the Row Source

    SELECT DISTINCT tblProgramming.ID, tblProgramming.Make FROM tblProgramming ORDER BY tblProgramming.Make;

    But it still shows me multiple entries of the same name.
    When i take out tblProgramming.ID i then get a blank combobox

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    it will do because of the ID. you should have a separate table for Make and storing the ID in tblProgramming, not the description. - Then your rowsource would be based on the make table

    If you haven't then the ID is irrelevant since it is not the ID of the make. The reason you are seeing a blank combo is because you have hidden the first column - this should be left blank or have a value greater than the width of the combo control - and your column count should be 1, not 2

  7. #7
    bar891 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    20
    Thanks for your help.. I have it working now
    I have made an extra table for Make

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

Similar Threads

  1. Replies: 1
    Last Post: 09-25-2018, 04:07 PM
  2. Replies: 3
    Last Post: 01-29-2016, 08:52 PM
  3. Replies: 1
    Last Post: 12-16-2014, 09:16 AM
  4. Replies: 2
    Last Post: 04-15-2014, 10:03 PM
  5. Replies: 8
    Last Post: 12-05-2011, 01:55 PM

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