Results 1 to 2 of 2

Thread: Linked Table Usage

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Location
    Sunny Scottsdale Arizona
    Posts
    254

    Question Linked Table Usage

    I currently house my data in an MS Acess db. Way back when, I brought in some tables (linked) from another db. Now we are looking at eliminating the other db and I need to find out how I am using those 5 tables I linked so long ago.

    Is there a way I can tell which queries are using these tables without having to go into each one (I currently have 167 queries in my db)?

  2. #2
    Lively Member
    Join Date
    Oct 2002
    Location
    Los Angeles, CA
    Posts
    73
    I usually output all queries defenition in some text file, then just search this file for a table name
    Below is a very dirty way to output query defenition.

    Dim db As Database
    Dim qr As QueryDef
    Dim i As Integer
    Dim strOut As String
    Dim fso As Object 'As New Scripting.FileSystemObject
    Dim objFile As Object 'As Scripting.TextStream
    Dim strSQl As String

    Set fso = CreateObject("Scripting.FileSystemObject")

    i = 1
    Set db = CurrentDb

    For Each qr In db.QueryDefs
    strSQl = qr.SQL

    'If InStr(strSQL, "Delete") = 0 Then
    strOut = strOut & i & ". " & qr.Name & vbNewLine & strSQl
    strOut = strOut & "*****************************************************" & vbNewLine
    'End If

    i = i + 1
    Next

    Set objFile = fso.CreateTextFile("d:\temp\temp_Queries.txt")
    objFile.Write strOut

Posting Permissions

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



Click Here to Expand Forum to Full Width