Results 1 to 4 of 4
  1. #1
    ishchopra is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5

    Update Column from Another Column - Plz check attachment

    Hello Experts,



    I have a table with a column called Z_Status: the values of this column are DUP and Survivor, which means one of the record is Duplicate and another is survivor.

    Now i have to update last Column called New_Account from Column C (EV870_ACCT_CODE), the New_Account Column should only be updated by the Max(EV870_ACCT_CODE) when grouping the information by Key2 Column.

    I have shown the output and highlited the result in Green background (please check the attachment).

    Apologize if i have not explained it well.

    Waiting for the suggestions

    CheersClick image for larger version. 

Name:	Sample.jpg 
Views:	10 
Size:	123.1 KB 
ID:	9130

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try:

    UPDATE tablename SET New_ACCOUNT = DMax("EV870_ACCT_CODE","tablename","Key2='" & [Key2] & "'");

    Is this real names and emails you have posted? Might want to remove the attachment.
    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.

  3. #3
    ishchopra is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5
    Hello,

    Thanks for looking into this, i have tried it but it doesnt work

    can you please explain what this part is doing : DMax("EV870_ACCT_CODE","tablename","Key2='" & [Key2] & "'");


    Please help

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I tested the sql on the sample data you show. It worked for me. What happens when you try - error message, wrong results, nothing? Show your exact sql statement.

    DMax is a domain aggregate function. In this case it is retrieving the maximum EV870_ACCT_CODE value for each KEY2 value.
    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. Want to update a column A if column B = column C
    By AudiA4_20T in forum Queries
    Replies: 5
    Last Post: 08-08-2012, 02:42 PM
  2. Replies: 1
    Last Post: 06-20-2012, 12:18 PM
  3. Replies: 0
    Last Post: 04-28-2011, 02:28 AM
  4. Total of column with check boxes
    By turbosdad in forum Queries
    Replies: 4
    Last Post: 08-07-2010, 07:03 AM
  5. List box column check..
    By empyrean in forum Programming
    Replies: 1
    Last Post: 10-28-2009, 08:18 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