Results 1 to 5 of 5
  1. #1
    damngroundhog is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2019
    Posts
    5

    using the append query to update a table where values are different

    Hello New to access and the forum. have had wonderful guidance so far and am looking for some expert opinions. I have a table which i need to update once a week. I get my updates from an excel spreadsheet. I upload that spreadsheet into a new table. Now i have 2 tables, my main table and my spreadsheet table. I am seeking to add only the new items from the spreadsheet. The workID's are the unique identifiers and I don't want duplicates. In the query window, i created the relationship with the two tables and the workIDs. I used an append query and in the criteria i used the build function and set those to be not equal to each other "" looks like this [main]![WorkID][sheet1]![workID] it returns 0 rows. If i remove that criteria, i would get the number of rows where the ID's are equal. Any advice is duly appreciated. Groundhog

  2. #2
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    Groundhog,

    it sounds to me that you may want to look at an Append query. Are all of the items in the new table actually new or does it have items previously imported?

  3. #3
    damngroundhog is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2019
    Posts
    5
    This is an append query.

    The new table, which comes from a spread sheet, has new and older items. I don't want the older items only the new items.

    this is what my criteria looked like in the append query under the workID

    [main]![workid] <> [sheet1]![workid]

  4. #4
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    Sorry, I misread the original post, when I saw update I thought you were using an update query. Before you import the xl file, can you delete the older data? That way any data in table 2 would be new data and it would be easier for you to just append?

    What are you using as your primary key on the import? Are you letting access add the primary key?

    Edit: If you can post a zipped copy of the database I should be able to assist.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    There is a simple way if you can use code and the target table is set to not allow duplicates. You simply run the append and rather than get the standard message that n records can't be processed, you suppress the warning. Whatever is new gets appended. Whatever is not new is bypassed. The warning can be suppressed by turning them on and off if using RunSql method (not my favourite thing to do) or CurrentDb.Execute without using dbFailOnError option.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 3
    Last Post: 06-01-2017, 06:57 AM
  2. Replies: 11
    Last Post: 03-24-2016, 06:12 PM
  3. Replies: 15
    Last Post: 10-18-2015, 04:05 PM
  4. Replies: 0
    Last Post: 09-03-2014, 02:37 PM
  5. Replies: 4
    Last Post: 03-10-2014, 11:33 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