Solved

TableDef Properties

Posted on 2004-10-31
1,244 Views
Last Modified: 2008-02-26
which property tells me if a table is linked or not?

i.e. TableDefs(xx).Properties(???)

thanks
0
Question by:tricks801
    4 Comments
     
    LVL 4

    Accepted Solution

    by:
    For this to work you have to have a reference set to DAO (Ask me and I will tell you how to do this)
    This code will pop up a message box listing all the linked tables by name


    Dim db As Database
    Dim tdf As TableDef
    Set db = CurrentDb
    For Each tdf In db.TableDefs
            If Len(tdf.Connect) > 0 Then
                MsgBox db.TableDefs(tdf.Name).Name
            End If
    Next tdf
    0
     
    LVL 34

    Assisted Solution

    by:flavo
    here's a quick example
    Dim tbl As DAO.TableDef
    Dim db As DAO.Database

    Set db = CurrentDb

    For Each tbl In db.TableDefs
        If Left(tbl.Name, 4) = "msys" Then
            'system table
            'skip it
        Else
           If tbl.Properties("Connect") = "" Then
                MsgBox "not linked " & tbl.Name
            Else
                MsgBox "linked " & tbl.Name & Chr(10) & tbl.Properties("Connect")
            End If
        End If
    Next

    Dave
    0
     
    LVL 34

    Expert Comment

    by:flavo
    hmm.. tooo slow i guess
    0
     
    LVL 4

    Expert Comment

    by:mydatabaseguy
    Sorry... you can do it without setting a reference using late binding
    this way

    Dim db
    Dim tdf
    Set db = CurrentDb
    Set tdf = db.TableDefs
    For Each tdf In db.TableDefs
            If Len(tdf.Connect) > 0 Then
                MsgBox db.TableDefs(tdf.Name).Name
            End If
    Next tdf

    set tdf = nothing
    set db = nothing
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    MS Access excluding weekends in graph 5 25
    ms access query 5 24
    Microsoft Access query 4 15
    FTP file upload from within Access 1 22
    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now