Results 1 to 3 of 3
  1. #1
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246

    Query function to return table name and primary key name as values

    Access 2007, SQL Server 2008. I have normalized a complex (non binary) set of relationships associating multiple tables of people and their relationships to each other. I am past the architecture phase and am testing some of my concepts for functionality. What I need, or at least would be helpful for proofing my concept, would be an Access 2007 Select Query Function (expression builder) that returns the Table Name, and the PrimaryKey Name as values in the returned record set. This will be in the query builder and not in VBA. If there was such a function it would allow a much wider range of records I could join in one table. So I have two questions:

    1. Is there a function that will return the table name and primary key name as values in the returned set from the select query.

    2. If there is such a function will it survive as a SQL pass through query?

    Right now I am not trying to argue the validity of my concept but just the existence of the function.

    Any help?

    Phred

  2. #2
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Hope this is answer to all your question

    http://stackoverflow.com/questions/7...e-in-ms-access

  3. #3
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246

    Query Sys tables in Access 2007 to return info on tables and fields.

    Thank you. It is an excellent start. I have read briefly about pulling from the sys tables in Access, but this is the first time I have ever seen any code related to it. I need to pull it apart and see if I can modify it to my needs. I wanted to thank the poster at Stack Overflow but couldn't figure out how on their system. So credit and thanks to Igor Turman, Stack Overflow, for the following example:

    Code:
    SELECT DISTINCT MSysObjects.Name
    FROM MSysQueries INNER JOIN MSysObjects ON MSysQueries.ObjectId=MSysObjects.Id
    WHERE (((MSysQueries.Name1) Like "*" & [TableName] & "*")) OR (((MSysQueries.Name2) Like "*" & [TableName] & "*"))
    Thanks to you drunkenneo.

    Phred

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

Similar Threads

  1. Replies: 5
    Last Post: 09-30-2013, 05:44 PM
  2. Replies: 3
    Last Post: 03-10-2013, 07:04 AM
  3. Query to return values
    By narendrabr in forum Queries
    Replies: 3
    Last Post: 01-08-2013, 09:30 AM
  4. Query return 0 for null values
    By rachello89 in forum Access
    Replies: 4
    Last Post: 02-23-2012, 08:38 AM
  5. Table with list of values - primary key filed
    By snoopy2003 in forum Database Design
    Replies: 1
    Last Post: 02-23-2011, 09:29 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