Results 1 to 3 of 3
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839

    Parent of a parent

    How do you look up the parent of the parent?



    Crosstab.zip

    Please look at Query 117

    I can use
    Code:
    IIf([LIN]="B286",DLookUp("[Parent]","[Data]","[Unique] ='" & [Unique] & "'")) AS B286PAR
    But that only shows on the row where LIN = B286. I am trying to get that to show it as the parent on the CH1 and CH2 Row in the query. Query 117 is what I have. I put in an ExampleOutput Table of what I am trying to get to.
    Attached Files Attached Files

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You need two queries

    Start with your query 117 then make a new query with Data table & query 117

    Code:
    SELECT [117].LinName, [117].LIN, [117].ChanUID, [117].Parent, Data.Parent AS B286Parent
    FROM 117 INNER JOIN Data ON [117].Parent = Data.Unique;
    Code:
    LinName LIN ChanUID Parent B286Parent
    155 Mtd B286 12313 12311 11321
    155 Mtd B286 12314 12311 11321
    155 Mtd B286 12315 12312 11321
    155 Mtd B286 12316 12312 11321
    155 Mtd B286 12317 12319 12321
    155 Mtd B286 12318 12320 12321
    CH1 B840 12321 12313 12311
    CH1 B840 12322 12314 12311
    CH1 B840 12323 12315 12312
    CH1 B840 12334 12316 12312
    CH1 B840 12335 12317 12319
    CH1 B840 12336 12318 12320
    CH2 B841 12337 12313 12311
    CH2 B841 12338 12314 12311
    CH2 B841 12339 12315 12312
    CH2 B841 12340 12316 12312
    CH2 B841 12341 12317 12319
    CH2 B841 12342 12318 12320
    Attached Files Attached Files
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    ridders52,
    Thanks, Appreciate it.

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

Similar Threads

  1. Replies: 3
    Last Post: 07-03-2013, 01:20 PM
  2. Parent Child Relationship
    By Guru86 in forum Database Design
    Replies: 1
    Last Post: 06-20-2013, 10:48 AM
  3. Using Me.Parent in a query
    By Historypaul in forum Forms
    Replies: 7
    Last Post: 02-17-2013, 10:23 PM
  4. SubForm to Parent
    By henryclay in forum Forms
    Replies: 2
    Last Post: 11-15-2006, 09:44 AM
  5. SubForms to Parent
    By henryclay in forum Forms
    Replies: 2
    Last Post: 10-27-2006, 07:14 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