The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    MS Access 97 question:How do I modify "find duplicates" to find adjacent values?

    Discussion in 'Windows OS and Software' started by A. Nonymous, May 10, 2007.

  1. A. Nonymous

    A. Nonymous Notebook Guru

    Reputations:
    21
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    15
    I actually posted the following question on another site (Access forum) but received no bites so I thought I'd ask here...


    I've used the "Find Duplicates" wizard to find occurrences of records with the same date in the date field of my database (5000 records to sift through). These tend to be unnecessary entries which I will then manually delete.

    What I would like to do now is modify this query to find dates RIGHT NEXT to each other.

    Example:
    * Previously, 12/25/06 and 12/25/06 showed up as duplicates.
    * Now I'd like (12/24/06 and 12/25/06) and/or (12/25/06 and 12/26/06) to show up in this query together.

    If the current syntax is this:
    In (SELECT [cust_ID] FROM [Database] As Tmp GROUP BY [cust_ID],[Exp Date] HAVING Count(*)>1 And [Exp Date] = [Database].[Exp Date])

    How do I modify it to find adjacent dates within each given customer's records?

    Thanks.
     
    Last edited by a moderator: May 8, 2015
  2. Budding

    Budding Notebook Virtuoso

    Reputations:
    1,686
    Messages:
    3,982
    Likes Received:
    0
    Trophy Points:
    105
    SELECT [cust_ID] FROM [Database] As Tmp GROUP BY [cust_ID],[Exp Date] HAVING Count(*)>1 And [Exp Date] = [Database].[Exp Date] OR [Exp Date] = DATE_ADD([Database].[Exp Date],INTERVAL 1 DAY) OR [Exp Date] = DATE_SUB([Database].[Exp Date],INTERVAL 1 DAY)

    Does that work? If not, what is the error?