Results 1 to 2 of 2
  1. #1
    luckycharms is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Posts
    8

    Rename cell based on duplicate compound key

    Hi Folks,

    I'm trying to rename a cell when there are duplicates of mutliple columns. Here's an example
    Code:
    Col_1   Col_2   Col_3   Note
    A1      B1      C1      
    A1      B2      C1      Not a Dup
    A1      B1      C2      Not a Dup
    A2      B2      C2      
    A2      B2      C2      Duplicate
    A3      B3      C3      
    A3      B3      C3      Duplicate
    A3      B3      C3      Duplicate
    



    I would like the query or code to update Col_3 (or add another column if that's easier) as below. Note that the order of the duplication is important.
    Code:
    Col_1   Col_2   Col_3   Note
    A1      B1      C1      
    A1      B2      C1      Not a Dup
    A1      B1      C2      Not a Dup
    A2      B2      C2      
    A2      B2      C2Dup1  Duplicate
    A3      B3      C3      
    A3      B3      C3Dup1  Duplicate
    A3      B3      C3Dup2  Duplicate
    I've seen solutions that use row_number() and over() clauses, but those just work in sql server. Any thoughts for how to tackle this in Access?

    Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    You need to calculate a value for a record based on value in another record. Requires subquery or VBA code.

    Review http://allenbrowne.com/subquery-01.html
    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.

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

Similar Threads

  1. Copying and Rename of Files based on fields
    By desk4tbc in forum Programming
    Replies: 2
    Last Post: 06-28-2011, 11:00 AM
  2. Creating Compound summations etc.
    By ohthesilhouettes in forum Queries
    Replies: 2
    Last Post: 06-19-2011, 12:29 PM
  3. Replies: 0
    Last Post: 04-18-2011, 01:01 PM
  4. duplicate record based on calculation
    By Coolpapabell in forum Queries
    Replies: 4
    Last Post: 08-06-2009, 07:53 AM
  5. Can we post Access cell data to Excel cell properties?
    By Zethro in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2005, 08:42 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