Results 1 to 2 of 2
  1. #1
    Hobbes29 is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    10

    avoid relinking linked tables


    I have some code that links tables to a backend, MS Access DB 2007. I am looking for assitance to have the code check to see if the table is already linked, and if it is linked then don't do anything. If The table is not linked, then link the table.

    I check for system tables (MSys) and tmp (~) tables and do not link them.

    Any assistance is appreciated.

    here is the code:

    Code:
     
    numTables = DBEngine.Workspaces(0).OpenDatabase(strPath).TableDefs.count -1
    for i = 0 to numTables
        tabName = DBEngine.Workspaces(0).OpenDatabase(strPath).TableDefs(i).Name
     
        if InStr(1, tabName, "msys") = False And _
           InStr(1, tabName, "~") = False Then
     
            lst.AddItem DBEngine.Workspaces(0).OpenDatabase(strPath).TableDefs(i).Name
     
            if CurrentDB.TableDefs(i).Name = "" Then 'Table does not exist in the front end so link it.
                Docmd.TransferDatabase .....etc
            end if
        end if
     
    Next
    Thanks,
    Ken

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    I use this code by my friend Crystal (Microsoft Access MVP):

    ReLinker: multi-BE, Label Table Description to show Connect info


    Boyd Trimmell aka Hi Tech Coach ( HiTechCoach.com free Access stuff)
    Microsoft Access MVP 2010
    Business Process Management - Accounting/CRM Software Developer
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

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

Similar Threads

  1. security on linked tables
    By wil in forum Security
    Replies: 3
    Last Post: 08-07-2010, 04:54 PM
  2. Help with Linked Tables
    By softspoken in forum Forms
    Replies: 22
    Last Post: 03-25-2010, 09:35 AM
  3. Linked tables and copy
    By TimG in forum Access
    Replies: 2
    Last Post: 10-08-2009, 07:54 AM
  4. help with linked tables
    By davidoakley in forum Access
    Replies: 9
    Last Post: 06-17-2009, 05:23 PM
  5. Relinking an ADE file to SQL tables
    By cjbuechler in forum Database Design
    Replies: 4
    Last Post: 06-05-2009, 09:48 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