Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    Unanswered: Determine the link type of Table in VBA

    Access 97

    When I enumerate through the tables collection - how can I determine the link type - ie. ODBC, or mdb etc.

    Any Ideas

    basically what I am doing is writing a startup procedure that will delete the link of my odbc tables and reattach them and then truncate the dbo_.

    I have the reattach and renaming down - I just need to determine the link type. The hack work around is to store the tablenames in a table and if the table name is found - then delete it - but this is not a very clean way - any ideas guys?

    PK - I know you have to have a snippett for this
    Dale Houston, TX

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Dim dBase As Database

    left(dBase.TableDefs(TableName).Connect,4) = ODBC

  3. #3
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    got it - good for the code bank

    Public Function determinelinktype()

    Dim accObject As Object
    For Each accObject In CurrentDb.TableDefs
    MsgBox left(accObject.Connect, 4) ' just to see if "odbc" is retunrned

    Next
    End Function


    thanks for the feed back rogue
    Dale Houston, TX

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    Though it relies on the undocumented? system tables, I doub there's going to be much changes
    Code:
    SELECT Name,
    Switch(
        Type = 1, "Native table",
        Type = 4, "ODBC linked table",
        Type = 6, "Jet linked table")
    FROM MSysObjects
    WHERE Type In(1, 4, 6)
    Roy-Vidar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •