Results 1 to 4 of 4
  1. #1
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29

    Conditional Update of Values from Excel Sheet

    Hi,



    I am wondering if there is a way to update/overwrite some of the value in my table with the values in an excel sheet. The values in my table should only be overwritten if certain conditions are met.

    Example

    I have a table with shipment tracking numbers and shipping dates along with a bunch of other misc data about that shipment. I also have an excel with some new updated information that only has the tracking numbers and dates.

    Is there a way to easily update the dates on my access table with the new dates in the excel file if certain conditions for that specific tracking number are met?

    I am trying to automate this process so I would like to have a macro or something that I could run that compares the data and updates the values if needed.

    Thanks

  2. #2
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    if you link the spreadsheet as a table and run an update query against your db table using the linked one as the source, then if there's updated data, it will overwrite. If there isn't, it won't make any difference. Unless you run an update when you shouldn't (for whatever reason that might be) then you can run it as many times as you want. No difference in source = no difference in target. You just have to decide how you want the query to be executed.
    Last edited by Micron; 02-22-2019 at 02:28 PM.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29
    I am not that familiar with update queries. Would I be running the update query in VBA in excel?

  4. #4
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    if you link the spreadsheet as a table and run an update query against your db table using the linked one as the source
    I had "lined" which I've corrected to "linked". If that doesn't clear it up, then
    - you link to the spreadsheet from Access
    - you have a db table already according to what I've gleaned from your first post
    - you update that table based on what's in your linked table (spreadsheet)
    - you use an update query to perform that update
    - unless you have some sort of special need, you don't need run to this query as code, although you might run/call it from button click code. That's not the same thing.
    - you google/bing "ms access update query" if you don't know what that is

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

Similar Threads

  1. Replies: 5
    Last Post: 05-24-2018, 01:15 AM
  2. Replies: 5
    Last Post: 04-25-2017, 01:38 AM
  3. Import Excel Sheet to Update Tables
    By guillermoftw in forum Access
    Replies: 4
    Last Post: 01-13-2015, 09:23 AM
  4. Replies: 41
    Last Post: 05-04-2014, 06:57 PM
  5. How to I update access with an excel sheet?
    By superfly5203 in forum Access
    Replies: 5
    Last Post: 01-24-2013, 10:52 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