Results 1 to 3 of 3
  1. #1
    sqlaccess is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    2

    How to query what inputs (tables or queries) are used in a query?

    Hi,



    I have an access database with a lot of tables and queries.

    I have the sql to get all the table and query names as below:

    However, what I want to do is to find the input tables and/or queries used in all of the queries in the database.

    Any ideas guys?

    Cheers

    --this gets the list of table names in an access database
    SELECT MSysObjects.Name AS table_name
    FROM MSysObjects
    WHERE (((Left([Name],1))<>"~")
    AND ((Left([Name],4))<>"MSys")
    AND ((MSysObjects.Type) In (1,4,6)))
    order by MSysObjects.Name
    ;
    --This gets the list of query names in an access database
    SELECT MSysObjects.Name
    FROM MSysObjects
    WHERE type = 5
    ;

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    This is valid for A2003; it should be valid for newer versions as well

    There is another system table called msysQueries which contains all the other information you need. I think Attribute = 5 identifies the records you want. You would join the two tables using msysObjects.ID = msysQueries.ObjectID.

    HTH

    John

  3. #3
    sqlaccess is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    2
    Quote Originally Posted by John_G View Post
    Hi -

    This is valid for A2003; it should be valid for newer versions as well

    There is another system table called msysQueries which contains all the other information you need. I think Attribute = 5 identifies the records you want. You would join the two tables using msysObjects.ID = msysQueries.ObjectID.

    HTH

    John

    Thanks John. Worked a treat!

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

Similar Threads

  1. Replies: 6
    Last Post: 11-13-2013, 04:17 PM
  2. Take Query Inputs From a Table
    By toonarmy in forum Queries
    Replies: 1
    Last Post: 11-13-2012, 09:01 PM
  3. Replies: 18
    Last Post: 10-10-2012, 10:10 AM
  4. Using user inputs as variables in a query/report?
    By cheese9799 in forum Reports
    Replies: 3
    Last Post: 03-01-2011, 11:30 AM
  5. Split Query Field into Sub Queries/Tables
    By maggioant in forum Queries
    Replies: 0
    Last Post: 10-15-2009, 05:23 PM

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