+ Reply to Thread
Results 1 to 6 of 6

excel to update an access table

  1. #1
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    excel to update an access table

    Struggling a bit with getting some vba to update an access table.
    I keep getting close but not close enough based on code designed to add records or and doing it in an inefficient way so probably better to get fresh advice.

    the scenario is that I have an access table with some entries and a excel spread sheet with some entries. and I want to update the lines on the spread sheet to the data base if the ID exists or add them to a new line if they do not exist (leaving any other lines in the data base unchanged).

    If I have a template (or even general instructions) for doing this I can probably work it out.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  2. #2
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: excel to update an access table

    If you can supply a sample Access file, we can try to see what we can do.

  3. #3
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: excel to update an access table

    Usually the access db pulls data from the XL sheets. Simple.

    It's harder to do it backwards, xl to Access.

  4. #4
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: excel to update an access table

    No, its not.... you can use ADO to connect to DB from Excel and write, read, delete, update data.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: excel to update an access table

    You can also link your Excel Table to Access. Then any updates to the Excel Table is automatically reflected in the Access Table.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: excel to update an access table

    OK,

    1) I zipped the data base so I could upload it.

    2) I have linked the power query to the data base using cell B2 in the index sheet. So that path is wherever the access database is saved.

    ----

    In reality there are two scenarios

    i) The green table in the inwards sheet reads from the database. In this table there should only be lines if they exist in the database - if they are changed they should be updated.

    ii) the main issue I was asking about - The blue one in the update sheet is for writing to the data base from a different source (a query from another database via an ODBC connection).
    I didn't have the unique database ID (from access) so I used a xlookup based on so_order_no & so_bo_suffix & stock_code being unique.

    So now the lines in this blue table may or may not exist in the database, if they don't I want to add them, if they do they should be updated (never deleting from the database).

    ----

    The process

    in practice it would run the blue table then update it to the access data base (so they have the latest info in the data base)
    then run the green table (now they can see it)
    then let them edit it and either a button or automatic update back to the access database. (now it is updated)


    I tried myself but I think my code was a confusing mess. Happy to have any part of the solution here.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Update Access Table from VBA Excel
    By saravnepali in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2020, 06:52 AM
  2. Replies: 1
    Last Post: 02-15-2016, 05:47 PM
  3. Excel VBA to update table in Access 2013
    By SUMIF in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-21-2015, 01:04 PM
  4. Trying to update an access table from Excel based on unique ID. rst.Update not working
    By Newbie0924 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2015, 04:15 PM
  5. Replies: 1
    Last Post: 12-02-2014, 05:46 AM
  6. [SOLVED] update table in access from excel using sql
    By specialk9203 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-19-2014, 03:44 PM
  7. Update Access Table from Excel using DAO
    By vish2025 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2010, 06:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1