Results 1 to 3 of 3
  1. #1
    jamies is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Scotland
    Posts
    2

    Master\Detail Only Show Last Detail Record

    Hi there,
    I have 2 tables; Product_Master and Product_Details, whenever there is a change a new record is created within the Product_Details table.

    Product_Master Looks Like (Product_ID,Product_Name,DateCreated,Verification, Drawing,Category)
    Product_Details Looks Like (Product_Detail_ID,Product_ID,DateTimeStamp,Create dBy,Photograph,Location,Packaging,Current_Status)

    I am needing a query that will pull out all The Products along with the last productDetail Created for that product.
    A standard query would pull out all records on both sides so it would appear that the product is listed however many times it is mentioned in the ProductDetails Table.
    In MSSQL I would use row_number() Over Partition and have it in a stored proc.

    Any help would be great.
    Thanks


    Jamie

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Assuming your PRODUCT_DETAIL_ID is an autonumber and you can reliably determine that the most recent record is the one you're after you can create this query:

    SELECT Product_ID, Max(Product_Detail_ID) as MRDetail_ID FROM Product_Details

    This query will give you the most recent product_detail_id for any product, you can then link that back to your either of your main tables to pull the information you want.

  3. #3
    jamies is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Scotland
    Posts
    2
    Thanks, did the job.

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

Similar Threads

  1. Simple report with master/detail records
    By dsajones in forum Reports
    Replies: 2
    Last Post: 06-21-2012, 04:36 PM
  2. Combine master detail records in one query
    By mariost in forum Queries
    Replies: 4
    Last Post: 05-14-2011, 11:25 AM
  3. Master/detail form problem....
    By dkperez in forum Forms
    Replies: 5
    Last Post: 04-01-2011, 04:28 PM
  4. Master Detail Web Form - Access 2010.
    By Robeen in forum Forms
    Replies: 2
    Last Post: 03-21-2011, 02:34 PM
  5. How to code master detail relation in tabforms
    By AshokS in forum Programming
    Replies: 18
    Last Post: 12-20-2010, 08:15 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