Results 1 to 10 of 10
  1. #1
    iordanis is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2024
    Posts
    11

    report with subreports having parameters


    I have a master report that has a subform for details. The detail subform, is based on a query that takes SQL parameters, using a global function in the WHERE clause for the criteria values.

    So, how (in which event) can I send the value from the each master report's row to the subreport, so it can retrieve its own detail records to be displayed on page. I use the PrintPreview view for all my printouts.

    MSAccess2013

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    I'd try Open event for the main report. You could retrieve a report field value, or if it's not there and can't be included, the OpenArgs property for the main report.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    iordanis is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2024
    Posts
    11
    No, what I want is, for every master record in the report, its details to be displayed, using a query with SQL parameters in the subreport. Is there a way (in some of the report's events, like in "currentrow" for forms) for the subreport, to use the master record's value, to retrieve the subreport records?

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    using a query with SQL parameters in the subreport.
    That doesn't change my answer. Your query would look to one or more main report controls to get the parameter values. I think most/many developers would set the Link Master Fields and Link Child Fields on the subform/subreport control and let that do the heavy lifting. If nothing suggested solves your problem, I think an explanation of how the main and sub reports are related.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    iordanis is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2024
    Posts
    11
    Well, Master Fields and Link Child Fields work when both the master report and the subreports have retrieved ALL respective records, but I don't want to retrieve that many records at once. For simplicity, my report has a main report object (let's say 100 master records on paper) and for each record, a subreport on the right, has to retrieve only the details for that record, so I used SQL parameters for the subreport's query. My question is, how (in which event and with which commands) I can syncronize the detail retrieval for each master record displayed.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    Seems to me what you describe should be accomplished with Master/Child Links or Sorting & Grouping arrangement. Perhaps you should provide db for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,273
    Quote Originally Posted by iordanis View Post
    Well, Master Fields and Link Child Fields work when both the master report and the subreports have retrieved ALL respective records, but I don't want to retrieve that many records at once. For simplicity, my report has a main report object (let's say 100 master records on paper) and for each record, a subreport on the right, has to retrieve only the details for that record, so I used SQL parameters for the subreport's query. My question is, how (in which event and with which commands) I can syncronize the detail retrieval for each master record displayed.
    I think you are confusing reports with forms.
    Once the data is generated, that is it.
    So the Master and Child fields are where anything is synchronised.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    iordanis is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2024
    Posts
    11
    I just want to know, if I can retrieve and display data for a subreport, using the master id value being formatted for display in the main report. I don't want to retrieve the whole detail table into the subreport, just to create filter links with the Master Fields and Link Child Fields properties. Too much in memory. Is this feasible with Access?

  9. #9
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Why can't you create a query with the master report table and the subreport table? You could use a subquery that extracts all the data from the subreport table using criteria from the main table. Then you could scrap the subreport as not needed. All the required data is in the main query with its subquery.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    If you pull in all records on main report, then how do you expect each to show its related child records in subreport? This is what Master/Child Links properties manage. Report's RecordSource cannot be dynamic. Either the data is retrieved when report opens or it isn't, dataset cannot be modified after report renders. So, simple answer to your question is "can't".

    If there is only one related child table involved, subreport is likely not needed. Join tables in report RecordSource and use Sorting & Grouping features.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Import query having parameters from excel
    By scorpion99 in forum Queries
    Replies: 1
    Last Post: 01-02-2014, 02:11 PM
  2. Empty Main Report, won't run subReports
    By rankhornjp in forum Reports
    Replies: 8
    Last Post: 03-15-2013, 11:07 AM
  3. Looping through a report with subreports.
    By less1die in forum Reports
    Replies: 1
    Last Post: 02-22-2013, 03:15 PM
  4. Replies: 4
    Last Post: 01-25-2013, 01:57 PM
  5. Replies: 1
    Last Post: 11-24-2012, 04:40 PM

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