Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TableDef Properties

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

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

thanks
0
Comment
Question by:tricks801
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
mydatabaseguy earned 1500 total points
ID: 12458538
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
flavo earned 500 total points
ID: 12458544
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
ID: 12458546
hmm.. tooo slow i guess
0
 
LVL 4

Expert Comment

by:mydatabaseguy
ID: 12458555
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

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

604 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