Results 1 to 2 of 2
  1. #1
    sujila is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    2

    Connect to external database access2010

    Hi,



    I need to create a 'After Update' macro that will add some values to a table in another database.
    How can I connect to another database using macro?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    AFAIK, can't do this with macro, need VBA. Example from my db:

    strExtract = gstrBasePath & "Program\Editing\ConstructionExtract.accdb"

    'delete records from ConstructionExtract tables
    CurrentDb.Execute "DELETE FROM Bituminous IN '" & strExtract & "'"
    CurrentDb.Execute "DELETE FROM BituminousMD IN '" & strExtract & "'"
    CurrentDb.Execute "DELETE FROM Concrete IN '" & strExtract & "'"

    'insert records into ConstructionExtract tables
    CurrentDb.Execute "INSERT INTO Bituminous IN '" & strExtract & "' SELECT * FROM ConstructionBIT;"
    CurrentDb.Execute "INSERT INTO BituminousMD IN '" & strExtract & "' SELECT * FROM ConstructionBMD;"
    CurrentDb.Execute "INSERT INTO Concrete IN '" & strExtract & "' SELECT * FROM ConstructionCONC;"

    I haven't tried an UPDATE action but suppose it should work as well.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 0
    Last Post: 08-18-2014, 09:11 AM
  2. Replies: 1
    Last Post: 05-29-2013, 03:08 PM
  3. connect to database
    By newaccess in forum Access
    Replies: 22
    Last Post: 04-05-2011, 02:54 PM
  4. Replies: 0
    Last Post: 03-28-2011, 11:05 AM
  5. Connect to external .mdb
    By bcobb2350 in forum Programming
    Replies: 8
    Last Post: 10-02-2009, 10:00 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