Results 1 to 5 of 5
  1. #1
    mariost is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Posts
    9

    Combine master detail records in one query


    Hi all,

    I would like to create one query that will combine records linked in a master/detail fashion. The results must be returned in one row. The reason for this is that I want to use this query to update data in an Excel spreadsheet.

    Specifically, I have a master table that keeps products (productID, productName, productDesc). I also have a details table with the batches of each product (batch_ID, batch_ProductID, batch_date). Each product can have multiple batches.

    I want with one query to return all the product details from the products table and all the related batches, BUT IN ONE ROW.

    Is this possible?

    Thanks for helping.

    Marios

  2. #2
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    if you want the seperate detail data, you're stuck with several rows even in Excel, but you can use a grouping query to group all details sum, average or other grouping function within 1 record.

    grNG

  3. #3
    mariost is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Posts
    9
    Hi ,

    thanks for the response.

    It is hard to accept that there is no way to achieve this. I mean it is not that uncommon. And I know you can do it with MS SQL server.

    Anyone else to offer some help.

    Marios

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I can't do what you want using a query, but it can easily be done in code.

    Open a recordset of the data you want, loop through the recordset adding the data to one or more string variables and write the variable(s) to a text file.
    Then in Excel, import the file to a worksheet. Because the text file is tab delimited or comma delimited, each value in a row will be in put into a cell rather that all data in one cell.

  5. #5
    mariost is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Posts
    9
    Hi Steve,

    thanks for the response. This is what I did at the end.

    Thanks a lot

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

Similar Threads

  1. Replies: 3
    Last Post: 04-18-2011, 06:52 PM
  2. Master/detail form problem....
    By dkperez in forum Forms
    Replies: 5
    Last Post: 04-01-2011, 04:28 PM
  3. Master Detail Web Form - Access 2010.
    By Robeen in forum Forms
    Replies: 2
    Last Post: 03-21-2011, 02:34 PM
  4. How to code master detail relation in tabforms
    By AshokS in forum Programming
    Replies: 18
    Last Post: 12-20-2010, 08:15 PM
  5. Enable button in the master form when clicking in the detail
    By DistillingAccess in forum Programming
    Replies: 8
    Last Post: 08-03-2010, 10:54 AM

Tags for this Thread

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