Results 1 to 13 of 13
  1. #1
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8

    need distinct values in multiple drop down boxes


    Hi,

    I'm new to using Access. I have a form that has multiple combo boxes that filter out depending on criteria choosen in other combo boxes. The problem I am having is only one of the combo boxes shows distinct values and the others show multiple of the same values. I have distinct values choosen on each drop down box but for whatever reason it only works on one combo box. Any suggestions to fix this?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Show us any related code.

  3. #3
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    I have something like this in each combo box and it obviously changes depending on the combo box references:
    SELECT DISTINCT [T-Connection Configurations-Drop Down].[Connection Config], [T-DPF Records].[DPF Model]
    FROM [T-Connection Configurations-Drop Down] INNER JOIN [T-DPF Records] ON [T-Connection Configurations-Drop Down].[Connection Config] = [T-DPF Records].[Connection Config]
    WHERE ((([T-DPF Records].[DPF Model])=[Forms]![F-Find_DPF_Models_Filtering_Criteria]![cboDPFModel])) OR ((([Forms]![F-Find_DPF_Models_Filtering_Criteria]![cboDPFModel]) Is Null))
    ORDER BY [T-Connection Configurations-Drop Down].[Connection Config];

  4. #4
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    The combo box code that works correctly looks like this:

    SELECT DISTINCT [T-DPF Model List-Drop Down].[DPF Model], [T-DPF Records].Series
    FROM [T-DPF Model List-Drop Down] INNER JOIN [T-DPF Records] ON [T-DPF Model List-Drop Down].[DPF Model] = [T-DPF Records].[DPF Model]
    WHERE ((([T-DPF Records].Series)=[Forms]![F-Find_DPF_Models_Filtering_Criteria]![CboSeries])) OR ((([Forms]![F-Find_DPF_Models_Filtering_Criteria]![CboSeries]) Is Null));

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    In plain English, what is the data base about? What exactly is the purpose of the combobox(es)?
    Can you post a jpg of your tables and relationships?

  6. #6
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    Attachment 19182Attachment 19183The purpose of the database is so people can search for products from a table based on the criteria they know they need. Each criteria combo box filters out the next but it can also be left blank if they don't know or don't care about that criteria. But I only want unique values in each combo. Right now the unique values work at the DPF Model Combo and will continue to work as long as you go in order. But if someone leaves a combo blank and skips to the next combo all the values are duplicated.
    Attached Thumbnails Attached Thumbnails form.jpg   access-relationships.jpg  

  7. #7
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    any ideas?

  8. #8
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Bump, I'm curious to see a solution to this because I can definitely use something similar to this!

  9. #9
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    I'm not sure why there are links and and also displayed pictures. But the displayed pictures is what I wanted. Here are a couple more pictures with what is going on with the drop downs. But if I choose every box in order it's fine with no duplicates. Click image for larger version. 

Name:	no duplicates.png 
Views:	18 
Size:	10.8 KB 
ID:	19286Click image for larger version. 

Name:	duplicates.png 
Views:	19 
Size:	9.6 KB 
ID:	19287 Click image for larger version. 

Name:	drop downs in order.png 
Views:	19 
Size:	6.6 KB 
ID:	19288

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Need to review all of the queries and code. This will be much faster and easier if you provide the 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.

  11. #11
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    I have attached a copy of the database I'm creating for you to look at. Maybe it will help figure out what I am doing wrong. Thanks!
    Attached Files Attached Files

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You are not using values from designated PK fields as FK data. You are saving descriptive text. If the ID fields are not used in the PK/FK associations, should not be designated as PK. They aren't even required to be in the tables.

    There is no need to include the lookup tables in the combobox RowSource if you don't need other fields. Use LIKE and wildcard to deal with empty comboboxes.


    SELECT DISTINCT [DPF Model] FROM [T-DPF Records] WHERE Series LIKE [CboSeries] & "*";

    SELECT DISTINCT [T-DPF Records].[Connection Config] FROM [T-DPF Records] WHERE ((([T-DPF Records].[DPF Model]) Like [cboDPFModel] & "*") AND (([T-DPF Records].Series) Like [cboSeries] & "*")) ORDER BY [T-DPF Records].[Connection Config];


    Advise no spaces or special characters/punctuation (underscore is 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.

  13. #13
    Jss787 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    8
    June7- Thank you soooo much!! That fixed it and now works like a charm! I really appreciate your help with this!

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

Similar Threads

  1. Replies: 1
    Last Post: 04-30-2014, 01:05 AM
  2. Replies: 1
    Last Post: 09-27-2013, 04:18 PM
  3. Replies: 1
    Last Post: 03-28-2013, 11:10 PM
  4. help counting distinct values
    By joo-joo-man in forum Queries
    Replies: 2
    Last Post: 10-17-2010, 05:18 AM
  5. Distinct Values
    By Acramer8 in forum Reports
    Replies: 1
    Last Post: 06-15-2009, 08:37 AM

Tags for this Thread

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