+ Reply to Thread
Results 1 to 4 of 4

Updating Table in different database when opening current Database

  1. #1
    Forum Contributor
    Join Date
    11-01-2012
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    109

    Updating Table in different database when opening current Database

    Hi -

    I have two database - TMP.accdb and NAV.accdb. The NAV.accdb links to the tables that are sitting the TMP.accbd. The 10 tables with thousands of rows that are in the TMP.accdb which are coming from an excel file in my input folder.

    What I am trying to accomplish is when NAV.accbd is opened, the tables from TMP.accdb are updated to whatever excel tables are sitting in the input files.

    Lets say the tables are named as follows:
    TBL_15
    TBL_25
    TBL_35
    TBL_45
    TBL_55
    TBL_65
    TBL_75
    TBL_85
    TBL_95
    TBL_105

    I have updated the NAV database so my form called "Form1" opens when access is opened. I also updated a macro to run as Autoexec when the form is opened.

    What I am having difficulty with is the code that runs when the NAV.accdbd is opened to delete the tables in TMP.accdb and update them with the newest versions of the 10 tables list above.

    I don't know if deleting the tables and importing them into TMP.accbd is possible when opening NAV.accdb? Perhaps some other method is preferable than deleting and importing that is quicker?

    Any advice to get this working but most importantly efficient and quick is certainly appreciated!

    Thank you

  2. #2
    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,879

    Re: Updating Table in different database when opening current Database

    Why not just link the tables in Excel to your Access Database. Whenever the tables are updated in Excel, they are automatically updated in Access.

    https://www.techrepublic.com/article...cess-database/
    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
    Forum Contributor
    Join Date
    11-01-2012
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    109

    Re: Updating Table in different database when opening current Database

    Thanks for responding. I did actually link them via excel, but it takes a longer to have the links update in there so I was trying to create another database and phsyicalize the data there as to not bloat my NAV.accdb.

    Appreciate any insight

    Thanks!

  4. #4
    Forum Contributor
    Join Date
    11-01-2012
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    109

    Re: Updating Table in different database when opening current Database

    Here is what I have so far with what is working and what is not

    'Set Source Path For IVs
    ControlsPath = CurrentProject.Path & "\Input Files\Control Reports IV\"
    Set Dbase = CreateObject(CurrentProject.Path & "\temp\tempdb.accdb")
    Set appAccess = CreateObject("Access.Application")

    'WORKS DELETES TABLES IN THE TMP.ACCDB DATABASE
    Dbase.TableDefs.Delete ("TBL_10 TB Auto")

    'NOT WORKING - NEED TO FIGURE OUT TO IMPORT EXCEL FILES TO TMP.ACCDB
    appAccess.DoCmd.TransferSpreadsheet acImport, 8, "TBL_10 TB Auto", ControlsPath & "IV.xlsm", True, "10 TB Auto!"


    Thank you
    Last edited by mikey3580; 02-02-2019 at 12:45 PM.

+ 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. Opening a Specific Table In Access Database Using VBA
    By MBeedle in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-18-2013, 04:23 PM
  2. Updating Linked Table Database Location (Runtime)
    By split_atom18 in forum Access Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2013, 09:53 AM
  3. Match data between CSV and database and update column in database table
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2012, 05:59 PM
  4. Linking to updating database table
    By plannerg in forum Excel General
    Replies: 1
    Last Post: 08-25-2008, 07:20 PM
  5. Updating a database table
    By Michael Malinsky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2006, 01:40 PM
  6. [SOLVED] Delete a Table not in Current Database
    By Ross in forum Excel General
    Replies: 3
    Last Post: 05-12-2005, 10:06 AM
  7. [SOLVED] Changing a pivot table field items to current database
    By Pete Straman Straman via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2005, 01:06 PM
  8. [SOLVED] VBA Code for a pivot table to open database and to reference table current page
    By Pete Straman Straman via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2005, 12:06 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