+ Reply to Thread
Results 1 to 5 of 5

Exporting 7 excel columns to an Access Table using Excel VBA

  1. #1
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Smile Exporting 7 excel columns to an Access Table using Excel VBA

    Hello all. I' have an excel file that from a sheet DupCheck Prep,

    • I copy 7 columns (A through G) of data (of any number of rows) to,
    • an Access table tbl_InputData and then,
    • I run the access macro called Mac_RunDupCheck. I do this to check our database for records from this sheet that already exist.
    • Once complete the results show in a access table labeled as Tbl_DupCheckResults
    • The results span across 50+ columns of data which are pasted back into the excel workbook in a sheet called DupCheck Results


    I'd like to automate as much as this as possible using excels VBA. I'll simplify and re-summarize this up below if anyone can help! Thanks so much!

    Step 1.
    Excel Export to Access
    Sheet Name: DupCheck Prep
    Action: Columns (A,B,C,D,E,F,G) copied to Access Table below

    Step 2.
    Access Import
    DB Name: DupChecker 2016 v4.0
    Access Table: tbl_InputData
    tbl_InputData Field Columns (7): (SeqNum,InputName,InputAddress,InputAddress2,InputCity,InputState,InputZip)
    (tbl_InputData can remain open or closed from view)

    Step 3.
    Run Access Macro
    Macro Name: mac_RunDupCheck

    Step 4.
    Access Export to Excel
    Access results table name: tbl_DupCheckResults
    Export to Excel sheet name: DupCheck Results


    That's it! I really appreciate any help getting as far into the steps as you can get. Thanks!!


    Shelton A.
    If Helpful, Add Reputaion!

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

    Re: Exporting 7 excel columns to an Access Table using Excel VBA

    Here is an Access Template in .mdb format that I created awhile ago for importing spreadsheets into Access. See if this will get you started.
    Attached Files Attached Files
    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

  3. #3
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Exporting 7 excel columns to an Access Table using Excel VBA

    Thanks Alan,

    I definitely get where that template is going and thanks for sharing! The only thing is that it seems to function starting from the Access side of things and I need a 1 click solution started from the excel side even if it means importing the excel data into the access table and stopping at that point or continuing to the next step by calling the access macro and stopping at that point as users will be running other macros from within Excel in addition to this one requested.

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

    Re: Exporting 7 excel columns to an Access Table using Excel VBA

    I usually work from the Access side when doing this type of exercise. I did find what may work for you however.

    https://www.exceltip.com/import-and-...oft-excel.html

    Once the data is in the table, you can build your query in Access and automatically using the Docmd.transferspreadsheet function run the query and export it back to Excel. It is one continuous step.

    Have you built your Access query yet?

  5. #5
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Exporting 7 excel columns to an Access Table using Excel VBA

    Thanks i'll look at this and let you know.

    Yes the Access querys and tables are already built and run fine one their own

+ 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. Exporting a query from Excel to Access in a Excel macro
    By koltregaskes in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2011, 08:04 AM
  2. Exporting Excel to Access Table
    By PRodgers4284 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2009, 04:30 PM
  3. Exporting from Excel to Access
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-06-2008, 02:44 PM
  4. exporting Excel info to Access table
    By Dan McMillen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2008, 05:04 PM
  5. Access to Excel Exporting
    By cob943 in forum Excel General
    Replies: 3
    Last Post: 01-02-2008, 05:51 AM
  6. exporting access to excel
    By markmerid in forum Excel General
    Replies: 1
    Last Post: 10-09-2006, 09:28 AM
  7. [SOLVED] Exporting from access into excel
    By Chris in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2006, 04:05 AM
  8. [SOLVED] Error message in Excel after exporting Access query to Excel
    By Romi in forum Excel General
    Replies: 0
    Last Post: 06-06-2005, 10:05 AM

Tags for this Thread

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