Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37

    Is multiple sub-reports is the best solution?

    Hi,
    I've an Access database contains main table which is related with some other tables by "ID".
    following is a simple example:
    Click image for larger version. 

Name:	Capture.JPG 
Views:	31 
Size:	34.4 KB 
ID:	41690
    I created a report to display the data as on the provided example and used 2 subreports (subrepoet1 & subreport2) linked by ID.
    I tried to create a query for such report but failed because of repetition.
    My questions are:
    -Is there any other way to create the report as per attached image?
    -Is it possible to filter the report by I filed in subreport? (e.g. if the subreport1 value is "BB" the report shall display first & last records only.
    Thank you.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    The output would be:
    id-101
    data
    subrpt1
    subrpt2

    id-102
    data
    subrpt1
    subrpt2

    etc...

  3. #3
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    Sorry I didn't get you.
    I want the output report as per attached image.

  4. #4
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    274
    Of course it can be done, but it is necessary to understand the structure of the database to give you the right answer.
    So you should attach an example access file.

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    i dont think Access reports work that way.

  6. #6
    Join Date
    Apr 2017
    Posts
    1,792
    You create 2 separate reports which return data like your subreports. Then you create a 3rd (main) report based on your main table. (There a 2 possible ways - a simple report where a row is for ID value, or you group rows by ID, and have main table info in group header - I'm not sure which way will work so you have test it yourself.) And then you insert 2 subreports into main report (in design mode drag-and-drop) - either into report detail or report group header (test yourself which works). And then link subreports with main report.

  7. #7
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    The second way was exactly what I did (main report & 2 subreport) linked with the main report by ID and it worked fine.
    but when I tried to filter the data on an item in subreport I failed.
    and I'm asking if there is alternative method to do in a query to get same report.
    Thank you,

    Quote Originally Posted by ArviLaanemets View Post
    You create 2 separate reports which return data like your subreports. Then you create a 3rd (main) report based on your main table. (There a 2 possible ways - a simple report where a row is for ID value, or you group rows by ID, and have main table info in group header - I'm not sure which way will work so you have test it yourself.) And then you insert 2 subreports into main report (in design mode drag-and-drop) - either into report detail or report group header (test yourself which works). And then link subreports with main report.

  8. #8
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    Quote Originally Posted by CarlettoFed View Post
    Of course it can be done, but it is necessary to understand the structure of the database to give you the right answer.
    So you should attach an example access file.
    I'll try to make an example in access

  9. #9
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    The attached access sample is what I did. sample01.zip
    My question is, if it possible to filter the report "MainData" by a filed in "Items" ( the subreport) ? (e.g. if the "Items" value is "BB" the report shall display first & last records only.

  10. #10
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    Just reminder
    Thank you,

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Can you please show us how exactly you would like that filter to work?

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  12. #12
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    Thanks for responding Gicu.
    I want to filter the report "MainData" based on a value in subreport "Items".
    for example: if I want to display the records which contains ItemDesc ="BB" on the subreport "Items", the "MainData" report shall display only first & last records.Click image for larger version. 

Name:	Capture2.JPG 
Views:	15 
Size:	41.8 KB 
ID:	41722

  13. #13
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    First and last in Access only have meaning when referred to in conjunction with a specific sort order. What would that be in your case?

  14. #14
    ashraf is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    37
    Sorry Gicu, I didn't get you

  15. #15
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Your data is not clear enough as in your sample you only have two BB's so we wouldn't know which one to eliminate. If the sort order of the man data source changes, for example you sort descending by a "received" date or order date and then ascending by company name, the "first" and "last" will be different than if you would have sorted first by company ascending and then by date.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 02-08-2017, 04:11 PM
  2. Replies: 30
    Last Post: 08-08-2016, 03:54 PM
  3. Replies: 2
    Last Post: 05-24-2014, 09:47 AM
  4. Replies: 2
    Last Post: 10-12-2013, 11:17 AM
  5. Replies: 0
    Last Post: 07-26-2010, 07:34 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