Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    UK
    Posts
    21

    Unanswered: Dynamic Pass-through Queries and Sub-Reports

    I have a report based on data from a passthrough query, which contains a sub-report also based on remote data. The sub-report OnOpen procedure opens the parent report's query and uses that to dynamically filter its own data by forming a new SQL statement (for example iterating throught the recordset and creating a "WHERE id IN (1,2,3,4)" filter.

    This has to be done because the table/view the sub-report is based on is huge, and Access can be really naive in the way it joins the parent/child reports, transferring massive amounts of data to the local machine to perform the join.

    So the RecordSource for the sub-report includes all the data needed for all records in the parent report, and if it is not linked to the parent data using 'Link Child/Parent Fields' then it prints the whole query out for each parent record (as expected).

    However - if the sub-report is now linked (e.g. 'Link Child Fields' = 'parent', 'Link Parent Fields' = 'id') then the sub-report is suddenly blank for all parent records.

    What went wrong? The sub-report and parent report definitely contain the fields used in the link, and there is definitely data that should be displayed (I can monitor the pass-through queries used, and they are accurate and efficent).

    Any ideas?

  2. #2
    Join Date
    Oct 2002
    Location
    UK
    Posts
    21
    It turns out Access doesn't support linking for pass-through queries in a sub-report. So that's a dead end then.

    I'm experimenting with dynamically creating linked tables instead, which are fairly efficient and can be linked to data in a parent report.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •