+ Reply to Thread
Results 1 to 4 of 4

ADO and updating large number of fields in Access table

  1. #1
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    ADO and updating large number of fields in Access table

    Evening all,

    I have a table in Access which currently has 34 fields with scope to amend, delete and add additionals as time goes on.

    Im using ADO to pull the records from the database into Excel, do some stuff using forms and then update the record.

    I can update using Execute and a straight forward SQL statement however this would be a large string considering the number of fields.

    I can update using .Add on the recordset and although this would be neater and easier to amend, it still seems unwieldy.

    When I pull the data its straight forward, I can simply SELECT * and then dump the results in the range starting at A1 which fills the sheet with all the necessary columns, if I add or delete a column in the table it doesnt affect this, it would simply output one less column everything else would still be in the same order etc.

    What Im looking to do is therefore the reverse of that, have some code that cycles through the columns in the sheet and updating the relevant field in table (probably using the .Add method) ie whatever is in column 1 goes into field 1 of the table, col 2 to field 2 etc regardless of field names etc.

    Is there an easy way to do this?
    If someone has helped you then please add to their Reputation

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: ADO and updating large number of fields in Access table

    So do you wish to Update Data, or Insert new Data?
    Cheers!
    Deep Dave

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: ADO and updating large number of fields in Access table

    theres a need for both updating of existing records and insertion of new.

    In the original post I've probably complicated things with the "(probably using the .Add method)" which should have read .Update

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: ADO and updating large number of fields in Access table


+ 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. Replies: 8
    Last Post: 03-13-2014, 09:52 AM
  2. [SOLVED] Dynamically updating fields in Pivot Table
    By SandPounder1 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-11-2014, 04:00 PM
  3. Replies: 0
    Last Post: 04-10-2013, 11:29 AM
  4. updating fields in table after lookup
    By Kezwick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2011, 05:27 AM
  5. Querying alternative workbook/imported access table and updating fields accordingly.
    By 5habbaranks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-07-2010, 08:51 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