Results 1 to 7 of 7
  1. #1
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71

    Update Data on a table from another table with new data

    Table_1_customers
    Table_2_MailingList



    I have 2 tables, one of them (Table_1_customers) has contact information for all of my customers. It has Name, birthday, address and phone number for data on the table. The other table (Table_2_MailingList) has been updated with new customer information specifically, phone number. Many of the records in the original table have null values for phone numbers. I want to add those phone numbers from table 2 to table 1 without impacting any of the other data. I trust the data in table 1, but not sure about table 2. So, if I dont have any information in a customers record in the phone number field of a record, I want to add it from this record on this table.

    Table_1_customers
    Field Names
    ID, Name, Birthday, Address, PNumber

    Table_2_MailingList
    Field Names
    ID, Name, Birthday, Address, PNumber

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Run an UPDATE sql action.

    You don't show a unique customer ID in either table. How can you be sure the names will match? What if there are two customers named John Smith?
    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
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71
    I do have an ID field in the hypothetical issue above. I dont know how to do an "Update sql action". what code would I need to write for that to work?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Build a query object. Access Help has guidelines on using the query builder.

    Is this something will have to do periodically or is this a one-time fix?
    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.

  5. #5
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71
    It's a one time fix, I understand how to create an update query. I'm just not sure on what I need to do to get the criteria of the fields to line up properly

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What criteria?

    Do an INNER JOIN, requires related records in both tables.

    Then click UPDATE from the ribbon, under the primary table phone field on the Update To row:

    Nz([phone], [linktablename].[phone])

    Click Run.
    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.

  7. #7
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71
    Thank you very much, that did the trick. I will for sure use this again for other items.

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

Similar Threads

  1. Replies: 5
    Last Post: 09-06-2013, 11:52 AM
  2. Replies: 7
    Last Post: 03-21-2013, 09:43 AM
  3. Replies: 3
    Last Post: 09-16-2012, 10:20 AM
  4. Replies: 0
    Last Post: 05-21-2012, 11:54 PM
  5. Replies: 6
    Last Post: 05-10-2012, 08:20 PM

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