Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Eliminating Duplicate values in a combobox (2002)

    I have a combo box that gets it's values from entries from the Date field of tblCustomers. I made a little popup form that you select cboDateBeg and cboDateEnd and these values are used as a parameter in a query. this selects those dates and then that resultant query is used in a listbox lstCustomers.
    The problem I have is if there are several dates the same i.e 1/26/02; 1/26/02 etc. these are listed in the combo box. I only want one instance of 1/15/02. I used default = unique values and tried unique records-no joy.
    Frank

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Eliminating Duplicate values in a combobox (2002)

    Open the list in design view.
    Go to the rowsource and click on the symbol to the right (...)
    This will show the query design for the list.
    At the top of the screen, press the symbol that looks like an E only backwards, this will add an extra row in the query.
    Make sure it says "Group By" and preview it.
    If you're still getting duplicates, it's because of the other field in the query.

    That should get you started in solving your prob

    Dave

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Eliminating Duplicate values in a combobox (2002)

    If the dates in the field are general dates (i.e., they're entered by using the Now() function, which includes time) then using Unique Values won't work the way you want it to without a bit more work. You'll need to wrap the [Date] field in a Format(tblCustomers.[Date],"Short Date"), which will give you a short date (no time portion) and the unique values should work on that. You'll need to make sure your query criteria using the date parameters from the form is something like this:

    <pre>>= CDate(forms!frmPopup!cboDateBeg) And < DateAdd("d",1, forms!frmPopup!cboDateEnd)</pre>


    If you add a day to End Date and use "less than", you'll get all the records for the actual End Date , right up to midnight when the next day begins.
    Charlotte

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Eliminating Duplicate values in a combobox (2002)

    That did it.
    I never knew you could use this function to eliminate duplicates very interesting. Don't know why it works but very nice solution.
    Frank

  5. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Eliminating Duplicate values in a combobox (2002)

    Thanks Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •