Results 1 to 4 of 4
  1. #1
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71

    Best way to append and update records

    I have a list of products that need updating as well as new products to be added. Taking Northwind Traders Database as an example of products table, what is the best way to A) find that a product name is the same in my dummy table (pasted from Excel after ensuring that all data fields have matches) and edit the existing records with new data from other fields (list price, billing price) as well as add products that are not in the existing table so there are no duplicates.



    The product name is calculated by the concatenation of three fields (category - volume - flavor) so the product name will be the same as long as these three fields match. No product name duplicate can exist)

    I need to somehow make sure the product name calculated from the query is not already in the products table so as to get unique records to add. And another query must update the existing records with any details that are different.

    Whats the best way to go about this. I don't mind multiple queries or even a form based solution (in fact this would be the ideal one)

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,603
    Options:

    1. set the 3 fields as compound index and Access will not allow duplicates - it will notify user if they attempt to save record with duplicate

    2. use VBA code to validate the combination is not duplicate

    Users should not interact directly with tables/queries. Either option will work with a form. Just decide how much control you want to exercise and if you want to use VBA. Option 1 is simplest, Option 2 can be a bit complicated, especially because this involves 3 fields.
    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
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    At the moment it will not allow duplicates. But I need to make sure that when new product list is available I can just copy and paste it and the query would sort out the difference. This will be done once or twice in a year or so.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,603
    Why don't you do a test of the 'copy/paste' and see what would 'sort out'?
    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. Access can't append all the records in the append query
    By fluffyvampirekitten in forum Access
    Replies: 2
    Last Post: 08-27-2015, 01:53 AM
  2. Run Append and Update Queries
    By Govinda in forum Programming
    Replies: 1
    Last Post: 04-04-2013, 01:14 AM
  3. Replies: 3
    Last Post: 01-24-2013, 02:38 PM
  4. Replies: 3
    Last Post: 03-11-2012, 03:35 PM
  5. Append and Update criteria
    By gheaney in forum Queries
    Replies: 6
    Last Post: 10-09-2011, 07:48 AM

Tags for this Thread

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