Results 1 to 6 of 6
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    Is there a way of pulling Table Name into a query

    Hello, does anyone know if there's a way to insert Table Name into a query in order to use as an identified. The problem I'm having is that I have multiple tables with same exact field names however they refer to different "types". I want to join them but also have a way of identifying the type I'm querying.



    Thanks,

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    In the query design, make a hardcoded field to be added, and put the table name in. TBL: "myTable"

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Sounds like you may have a design issue. Instead of having multiple tables of similar structure for different types, you should have a single table with all your types, and a "Type" field that you use to denote which type each record is. This is a normalized design, and make many tasks much easier to perform.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sounds like a normalization problem. I'd have a single table with an additional field for type.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Dang slow typing skills on an iPad!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    ranman256, thanks what was simple and helpful. JoeM & pbaldy I agree that the design is not ideal but it's unavoidable based on reasons outside of my control. thanks!

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

Similar Threads

  1. Replies: 1
    Last Post: 02-19-2014, 05:49 PM
  2. Replies: 11
    Last Post: 04-22-2013, 04:21 PM
  3. Replies: 3
    Last Post: 12-07-2012, 04:26 PM
  4. Replies: 3
    Last Post: 06-07-2012, 07:06 AM
  5. Pulling values from a table
    By billdavidson in forum Programming
    Replies: 3
    Last Post: 05-16-2011, 11:44 AM

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